低级绘图--图例

legend(x, y = NULL, legend, fill = NULL, col = par(“col”),
border = “black”, lty, lwd, pch,
angle = 45, density = NULL, bty = “o”, bg = par(“bg”),
box.lwd = par(“lwd”), box.lty = par(“lty”), box.col = par(“fg”),
pt.bg = NA, cex = 1, pt.cex = cex, pt.lwd = lwd,
xjust = 0, yjust = 1, x.intersp = 1, y.intersp = 1,
adj = c(0, 0.5), text.width = NULL, text.col = par(“col”),
text.font = NULL, merge = do.lines && has.pch, trace = FALSE,
plot = TRUE, ncol = 1, horiz = FALSE, title = NULL,
inset = 0, xpd, title.col = text.col, title.adj = 0.5,
seg.len = 2)
x,y:图例位置坐标
legend:图例中的文字
fill:每个图例标签的颜色
col:图例中电线的颜色
border:边框颜色
angle :阴影线的角度
density:如果数值为正,阴影线的密度。如果为NULL or negative or NA 假定填充
bty :图例边框的类型
bg :图例边框的背景色
box.lwd :线条宽度
pt :点
xjust :值0表示左对齐,0.5表示居中对齐,1表示右对齐
x.intersp :用于水平(x)间距的字符间距因子

barplot(VADeaths,besides=TRUE,col=cm.colors(5))
legend(0.1,210,legend = rownames(VADeaths),ncol = 5,fill = cm.colors(5),bty = "n")

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/u010380670/article/details/84953847