减少小节中图例区域的大小 [英] Reduce size of legend area in barplot

查看:58
本文介绍了减少小节中图例区域的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这个情节中,我无法缩小图例的大小.有人可以帮我吗?我希望它显示在右上角,但不超过绘图区域高度的20%

I can't reduce the size of the legend in this plot. Could someone help me out? I want it to appear topright, but with no more than 20% of the height of plot area

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参数将为您做到这一点.

The cex parameter will do that for you.

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)

这篇关于减少小节中图例区域的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆