2012-05-15 7 views
3

어떻게 할 수 있습니까?라인과 바 플롯의 범례를 결합하여 R

내 현재 코드 :

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

는 전설을 생성합니다.

enter image description here

답변

6

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)); 
시도
관련 문제