减小条形图中图例区域的大小

标签 r plot legend

我无法减小此图中图例的大小。有人可以帮我吗?我希望它显示在顶部,但不超过绘图区域高度的 20%

a <- c(3, 2, 2, 2, 1, 2 )
barplot(a, beside = T,
col = 1:6, space = c(0, 2))
legend("topright", legend = c("a", "b", "c", "d", "e", "f"), fill = 1:6, ncol = 2)

最佳答案

cex参数会为你做到这一点。

a <- c(3, 2, 2, 2, 1, 2 )
barplot(a, beside = T,
        col = 1:6, space = c(0, 2))
legend("topright", 
       legend = c("a", "b", "c", "d", "e", "f"), 
       fill = 1:6, ncol = 2,
       cex = 0.75)

The plot

关于减小条形图中图例区域的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24361598/

相关文章:

plot.new() : figure margins too large 中的 RStudio 错误

python - 如何使 pygal 将图例分布到 n 列或正确截断?

r - 顶部位置的图例未显示

r - 使用 `texreg` 根据回归模型中出现的顺序显示变量名称

r - 如何在R中将30秒的数据聚合为15分钟的数据

r - R 中随时间变化的数据操作

R:ggplot2 - 根据标签手动设置点形状、线型和颜色

r - 如何使用嵌套图加速 react 速度?

python 2.7 matplotlib pylab : My plot is empty. 如何使数据点显示在图中?

python - 在跟踪上禁用悬停信息,plotly