【问题标题】:How to add a title to legend scale using levelplot in R?如何使用 R 中的 levelplot 为图例比例添加标题?
【发布时间】:2014-07-02 10:16:17
【问题描述】:

我想为这个情节的图例添加一个标题:

     library(lattice)
     x = 1:10
     y = rep(x,rep(10,10))
     x = rep(x,rep(10))
     z = x+y  
     levelplot(z~x*y,  
               colorkey = list(labels = list(cex=1,font=2,col="brown"), height=1, width=1.4),
               main = list('b',side=1,line=0.5))

产生:

【问题讨论】:

    标签: r plot levelplot


    【解决方案1】:
    library(lattice)
    library(grid)
    x = 1:10
    y = rep(x,rep(10,10))
    x = rep(x,rep(10))
    z = x+y  
    levelplot(z~x*y, colorkey=list(labels=list(cex=1,font=2,col="brown"),height=1,width=1.4),main=list('b',side=1,line=0.5))
    trellis.focus("legend", side="right", clipp.off=TRUE, highlight=FALSE)
    grid.text(expression(m^3/m^3), 0.2, 0, hjust=0.5, vjust=1)
    trellis.unfocus()
    

    【讨论】:

      猜你喜欢
      • 2016-08-20
      • 2018-04-16
      • 2013-06-14
      • 2020-03-18
      • 2018-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多