R语言中绘图,将图例设置在绘图区域之外
001、 正常绘图
par(mar=c(6, 6, 6, 6), xpd = TRUE) ## 绘图区域外留白 plot(1:10) legend('right',inset= 0.3, pch=19,legend='xxx') ## 绘图,图例在图形内部
002、图例放在图形正右方
par(mar=c(6, 6, 6, 6), xpd = TRUE) plot(1:10) legend('right',inset= -0.3, pch=19,legend='xxx') ## 图例在正右方
003、图例在正左方
par(mar=c(6, 6, 6, 6), xpd = TRUE) plot(1:10) legend('left',inset= -0.3, pch=19,legend='xxx') ## 图例在正左方
004、图例在正上方
par(mar=c(6, 6, 6, 6), xpd = TRUE) plot(1:10) legend('top',inset= -0.3, pch=19,legend='xxx') ## 图例在正上方
005、精确调整
a、
par(mar=c(6, 6, 6, 6), xpd = TRUE) plot(1:10) legend('topleft',inset= c(0.4, 0.1), pch=19,legend='xxx') ## c(0.4, 0.1), 0.4调整横向,0.1调整纵向
b、
par(mar=c(6, 6, 6, 6), xpd = TRUE) plot(1:10) legend('topleft',inset= c(0.4, -0.1), pch=19,legend='xxx') ## 横向0.4, 纵向-0.1