Question

I'm using xyplot in R to plot several lines (by group) on one graph:

xyplot(y~x,
       type=c('l'),
       scales=list(tck=c(1,0)),
       main=list(label="Total decrease", cex=2),
       xlab=list(label="Years", cex=1.5),
       ylab=list(label="Percentage", cex=1.5),
       groups= group,
       data=df,
       auto.key=list(columns=2, lines=TRUE, points=FALSE, cex=1.5))

However, I am unable to change the size of the label values. I have tried changing the argument cex.axis (within the xlab and ylab options), but this does not change the size of values along either the x- or the y-axes.

Can anybody help?

Thanks in advance, Mark

Was it helpful?

Solution

With lattice plotting functions, use scales=list(cex=1.5) to set cex for tick labels along both axes.

To specify different cex values for x- and y- axes, do something like this:

library(lattice)
xyplot(mpg~disp, data=mtcars, 
       scales=list(tck=c(1,0), x=list(cex=1.2), y=list(cex=1.5)))

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top