如何“重新安排” ggplot2 中的图例?
我有一个图,其中有多条线代表不同的数据列,图例被排列为垂直列,但我想将其放置在图表的底部并水平排列键,可以做到吗?谢谢!
I have a plot with several lines representing different columns of data, the legend is being arrange as a vertical column, but I want to place it at the bottom of the chart and arrange the keys horizontally, can it be done? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
现在确实如此。只需使用:
从0.9.2版本开始,
opts
已被替换 按主题
:It does now. Just use:
Since version 0.9.2,
opts
has been replaced bytheme
:不幸的是,在 ggplot2 的当前实现中没有。我认为 Hadley 将其列入他的待办事项中:-)
您始终可以手动定位图例,
但按键保持垂直:-/
Unfortunately not in the current implementation of ggplot2. Hadley has it on his to-do I think :-)
You can always position the legend manually
but the keys stays vertical :-/