【问题标题】:R How to set tick mark size using a trellis theme in Lattice?R如何在格子中使用格子主题设置刻度线大小?
【发布时间】:2013-10-24 22:30:27
【问题描述】:

我正在尝试使用格子主题来设置我的所有图形参数,以保持我的绘图语句简短。我似乎找不到正确的格子参数访问刻度线长度(或任何比例参数)。

library(lattice)

x = runif(100)
my.theme = trellis.par.get()
my.theme$axis.line = list(tck=c(4))     # this does not work
dp <- densityplot(~x)

# this works, but I want to do it using a theme
# dp <-densityplot(~x, scales=list(y=list(tck=c(4)))) 

png("dp.png", width=400, height=200)
trellis.par.set(my.theme)
plot(dp); dev.off()

【问题讨论】:

    标签: r themes lattice trellis


    【解决方案1】:

    每个绘图轴的刻度长度由 lattice 的图形参数列表中的axis.components 的(元素)控制。

    运行str(trellis.par.get("axis.components")) 以查看您的目标,然后执行以下操作:

    mytheme <- list(axis.components = list(left = list(tck=4), right = list(tck=4)))
    trellis.par.set(mytheme)
    densityplot(~x)
    

    【讨论】:

      猜你喜欢
      • 2023-04-01
      • 2014-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-28
      • 2022-06-10
      相关资源
      最近更新 更多