开发者

How to "re-arrange" the legend in ggplot2?

I have a plot with several lines r开发者_如何学Cepresenting 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!


It does now. Just use:

opts(legend.position="bottom", legend.direction="horizontal")

Since version 0.9.2, opts has been replaced by theme:

theme(legend.position = "bottom", legend.direction = "horizontal")


Unfortunately not in the current implementation of ggplot2. Hadley has it on his to-do I think :-)

You can always position the legend manually

opts(legend.position=c(0.5,0.5))

but the keys stays vertical :-/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜