【问题标题】:How to change the size of label values in xyplot in R如何在 R 中更改 xyplot 中标签值的大小
【发布时间】:2014-05-12 14:47:43
【问题描述】:

我在 R 中使用xyplot 在一张图上绘制多条线(按组):

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))

但是,我无法更改标签值的大小。我尝试更改参数cex.axis(在xlabylab 选项内),但这不会改变沿x 轴或y 轴的值的大小。

有人可以帮忙吗?

提前致谢, 标记

【问题讨论】:

    标签: r lattice


    【解决方案1】:

    使用 lattice 绘图函数,使用 scales=list(cex=1.5) 设置 cex 用于沿两个轴的刻度标签。

    要为 x 轴和 y 轴指定不同的 cex 值,请执行以下操作:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-14
      • 2019-08-12
      • 2015-10-11
      • 2011-07-18
      • 2014-08-21
      • 1970-01-01
      • 2021-07-25
      • 2013-06-18
      相关资源
      最近更新 更多