如何修改点阵图形图例中的列间距?

How can I modify column interspace in the legend of a lattice graphic?

我正在尝试使用 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()

我得到的是下图

问题出在图例中,列之间的距离太远,我无法适应所有 12 个月。任何减少列间距的想法?

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

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

甚至between=0.