How to change the size of label values in xyplot in R

11,466

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

Share:
11,466

Related videos on Youtube

user3628889
Author by

user3628889

Updated on September 15, 2022

Comments

  • user3628889
    user3628889 almost 2 years

    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