2013-10-16 45 views
1

我想使用格子主題來設置我所有的圖形參數,以保持我的繪圖語句簡短。我似乎無法找到正確的網格參數訪問刻度標記長度(或任何比例參數)。R如何在Lattice中使用格子主題設置刻度標記大小?

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

回答

1

蜱長度對於每個情節的軸是由(的元素)在晶格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) 

enter image description here

相關問題