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

Ser*_*.pv 19 plot r 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)
Run Code Online (Sandbox Code Playgroud)

And*_*rau 37

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)
Run Code Online (Sandbox Code Playgroud)

剧情

  • @Cina 我想你应该让 `cex` 大一点,然后使用 `pt.cex` 和 `title.cex`。使用 `?legend` 查看 `legend` 的帮助。 (3认同)