如何实现对数坐标轴刻度自动均匀分布?双Y轴对数转换优化
双Y轴对数刻度自动设置与优化方案求助
我现在要绘制大量双Y轴图表,其中第二个Y轴采用对数转换形式。目前只能手动设置刻度,希望找到自动设置刻度的方法,让刻度分布更美观自然;或者有没有更优的双Y轴对数转换方式?
当前代码
coeff <- 1/80000 p1 <- ggplot(lf_test, aes(x=time)) + geom_smooth(aes(y=normalized_gfp), size=2, span=0.3, fill = "#90d850", color = "#00BA38")+ geom_smooth(aes(y=od / coeff), size=2, span=0.26, color="tomato", fill="tomato") + scale_y_continuous(limits = c(0,80000), name = "Relative Flourescence [RFU]/[OD] ", sec.axis = sec_axis(~ 10^(.x*coeff)-1, breaks = c(0.01,0.25,0.5,0.75,1,1.25,1.5,1.75,2.0,2.5,5.0,7.5,10.0,15.0,20.0), name = 'OD600'))+ theme_grey() + theme( axis.title.y = element_text(color = "#90d850", size=13), axis.title.y.right = element_text(color = "tomato", size=13) ) print(p1)
当前生成图表

数据集片段
time media id od gfp normalized_gfp 180 21.36 IO+CasA+Fe_gfp 1 0.21 1839 8757.143 181 21.36 IO+CasA+Fe_gfp 2 0.25 4363 17452.000 182 21.36 IO+CasA+Fe_gfp 3 0.53 2204 4158.491 183 21.60 IO+CasA+Fe_gfp 1 0.22 1966 8936.364 184 21.60 IO+CasA+Fe_gfp 2 0.28 4517 16132.143 185 21.60 IO+CasA+Fe_gfp 3 0.54 2302 4262.963 186 22.08 IO+CasA+Fe_gfp 1 0.24 2084 8683.333 187 22.08 IO+CasA+Fe_gfp 2 0.31 4659 15029.032 188 22.08 IO+CasA+Fe_gfp 3 0.56 2395 4276.786 189 22.32 IO+CasA+Fe_gfp 1 0.25 2209 8836.000 190 22.32 IO+CasA+Fe_gfp 2 0.34 4953 14567.647 191 22.32 IO+CasA+Fe_gfp 3 0.57 2484 4357.895 192 22.56 IO+CasA+Fe_gfp 1 0.27 2323 8603.704 193 22.56 IO+CasA+Fe_gfp 2 0.38 5305 13960.526 194 22.56 IO+CasA+Fe_gfp 3 0.59 2687 4554.237 195 23.04 IO+CasA+Fe_gfp 1 0.27 2450 9074.074 196 23.04 IO+CasA+Fe_gfp 2 0.41 5588 13629.268 197 23.04 IO+CasA+Fe_gfp 3 0.60 2886 4810.000 198 23.28 IO+CasA+Fe_gfp 1 0.28 2664 9514.286 199 23.28 IO+CasA+Fe_gfp 2 0.44 5713 12984.091 200 23.28 IO+CasA+Fe_gfp 3 0.61 2993 4906.557
恳请各位提供帮助,非常感谢!
内容的提问来源于stack exchange,提问作者Salt_Industry
相关产品推荐
相关产品推荐

