如何修改图形图形图例中的列间隙?

时间:2015-05-05 13:33:23

标签: r graphics lattice

我正在尝试用格子包在R中创建一个图形。

我现在写的代码如下:

myColours <- brewer.pal(12,"Set3")
    my.settings <- list(superpose.symbol=list(col=myColours, border="transparent"))
    png("test_fig.png", width=8.9, height=7, units="cm",res=300)
    xyplot(sim.values~obs.values, groups=factor(mean.df$month,levels=mixedsort(as.character(unique(mean.df$month)))),data=mean.df,
           ylim=range(mean.df$obs.values), xlim=range(mean.df$obs.values),
           xlab=list(label="Obs mean daily rainfall [mm]",cex=0.7), 
           ylab=list(label="Sim mean daily rainfall \n[mm]",cex=0.7),
           scales=list(cex=0.6), pty="m", pch=20,
           auto.key=list(space="top", columns=6, text.width=0, cex=0.5, pch=20),
           par.settings = my.settings,
           par.strip.text=list(col="white", font=2),
           panel=function(...){
                 panel.abline(a=0,b=1)
                 panel.xyplot(...)})
    dev.off()

我得到的是下图 enter image description here

问题在于图例中,列彼此距离太远,我无法在12个月内完成任务。有什么想减少柱间间距的吗?

1 个答案:

答案 0 :(得分:1)

between添加到您的auto.key列表中。 例如,

auto.key=list(space="top", columns=6, text.width=0, cex=0.5, pch=20,between=.5),

甚至是between=0