如何在R latticeExtra DoubleYscale图中设置y轴限制和刻度线?我希望两个xyplots中的主要和次要y轴刻度和刻度标记相同。下面是我的R代码。目前,在图1中,主要y尺度为-3至0,次要y尺度为-150至0.在图2中,主要y尺度为-2至0,次要y尺度为-2至0。比例从-200到0 我希望主要的y尺度从-3到0,并且对于BOTH图,次要y尺度从-200到0,能够设置两个图中的刻度数。谢谢。
#load workspace stol and stoh
library(latticeExtra)
library(gridExtra)
plot1<-xyplot(percentloss*100 ~ time, groups=cap, pch=16,axis = axis.grid,
abline=c(list(h=c(0,-0.5,-1,-1.5,-2,-2.5,-3)),trellis.par.get("reference.line")),
main="Storage; 5 mL fill vol",
xlab="Time (hours)",
ylab="Evaporative loss (%)" ,
auto.key=list(border=TRUE),
par.settings = simpleTheme(pch=16), scales=list(x=list(relation='same'),
y=list(relation='same')),
data=stol)
plot2<-xyplot(absoluteloss*1000 ~ time, groups=cap, pch=16,
main=" ",
xlab="Time (hours)",
ylab="Absolute loss (uL)" ,
data=stol)
plota<-doubleYScale(plot1, plot2, style1 = 0, style2 = 0, add.ylab2 = T)
plot3<-xyplot(percentloss*100 ~ time, groups=cap, pch=16,axis = axis.grid,
abline=c(list(h=c(0,-0.5,-1,-1.5,-2,-2.5,-3)),trellis.par.get("reference.line")),
main="Storage; 10 mL fill vol",
xlab="Time (hours)",
ylab="Evaporative loss (%)" ,
auto.key=list(border=TRUE),
par.settings = simpleTheme(pch=16), scales=list(x=list(relation='same'),
y=list(relation='same')),
data=stoh)
plot4<-xyplot(absoluteloss*1000 ~ time, groups=cap, pch=16,
main=" ",
xlab="Time (hours)",
ylab="Absolute loss (uL)" ,
data=stoh)
plotb<-doubleYScale(plot3, plot4, style1 = 0, style2 = 0, add.ylab2 = T)
grid.arrange(plota,plotb, ncol=2)