在R中组合线和Barplot图例 [英] Combining Line and Barplot Legend in R

查看:70
本文介绍了在R中组合线和Barplot图例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法做到这一点?

Is ther a way to do it?

我当前的代码:

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

生成这样的图例.

推荐答案

尝试一下

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

这篇关于在R中组合线和Barplot图例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆