【问题标题】:Combining Line and Barplot Legend in R在 R 中结合线和条形图图例
【发布时间】:2012-05-22 18:14:04
【问题描述】:

有什么办法吗?

我当前的代码:

barplot(to_plot_bar,col=cm.colors(6,alpha=1),width=0.75,space=0.2,names.arg=x)
lines(dat_dens,lty=1,col="black");
legend("topright",ltext,bty="n",fill=cm.colors(6),
lty = c(0,0,0,0,0,0,1), lwd = c(0,0,0,0,0,1));

生成这样的图例。

【问题讨论】:

    标签: r plot legend


    【解决方案1】:

    试试这个

    ltext1 <- c(ltext,"emp") # this is not necessary if you already added 
    legend("topright",ltext1,bty="n",col=c(cm.colors(6),"black"),pch=c(rep(15,6),-1),
           lty = c(0,0,0,0,0,0,1));
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-07
      • 1970-01-01
      • 2015-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多