我希望将ggplot2图例旋转90°
从
qplot(mpg, wt, data=mtcars, colour=cyl)
Run Code Online (Sandbox Code Playgroud)

生产

就像是:
p <- qplot(mpg, wt, data=mtcars, colour=cyl)
p + scale_colour_continuous(guide = guide_legend(direction = "horizontal", title.position = "top",
label.position="bottom", label.hjust = 0.5, label.vjust = 0.5,
label.theme = element_text(angle = 90))) +
theme(legend.position = c(0.5, 0.9))
Run Code Online (Sandbox Code Playgroud)
参考:ggplot 文档
