[R] xyplot y scale label help
Ahmed Attia
ahmedatia80 at gmail.com
Thu Apr 17 02:54:31 CEST 2014
Hi R usres,
I would like to specify y label units in xyplot. I tried
the yaxp, but it does not work.
Following are my codes;
trellis.device(col=F)
xyplot(GY~N|S,data = Ahmed,
layout=c(5,1,1),
xlab=expression(paste("N rate (kg ", ha^-1,")")),
ylab=expression(paste("Biomass yield (Mg ",ha^-1,")")),
ylim=c(12,20), #xlim=c(-50,700),
strip = function(...) strip.default(...,style = 1), col=0,
par.strip.text = list(cex = 0.7),
scales = list(alternating=F, cex=0.7,yaxp=c(12,20,8)),aspect = 2,
panel = function(x,y,subscripts,groups,...) {
#panel.grid(-1,-1)
m1 <- lm(y ~ x)
x.seq <- data.frame(x=seq(min(x)*0.95,max(x)*1.05,max(x)/10))
pred <- predict(m1, x.seq, se.fit=T)
grid.polygon(c(x.seq$x,rev(x.seq$x)),
c(pred$fit + 2*pred$se.fit, rev(pred$fit - 2*pred$se.fit) ),
gp=gpar(col=0, fill="light grey", alpha = 1), default.units
= "native")
llines(x.seq$x, pred$fit, lty = 1)
panel.xyplot(x,y)
print(round(summary(m1)$coef[ 2,c(1,4) ],3) )
#ltext(0,0.5,paste("Slope = ",round(summary(m1)$coef[2],3),sep=""),
# cex=0.65, adj=0)
#ltext(0,0.4,paste("P(slope) =
",round(summary(m1)$coef[2,4],3),sep=""),
# cex=0.65, adj=0)
print(summary(m1))
}
)
Any ideas
Thank you
Ahmed M. Attia
Research Assistant
Dept. of Soil&Crop Sciences
Texas A&M University
ahmed.attia at ag.tamu.edu
Cell phone: 001-979-248-5215
FAX: 001-308-455-4024
More information about the R-help
mailing list