繁体   English   中英

r更改图例中符号的方向

[英]r change the orientation of the symbol in the legend

我有这个小R脚本

library(ggplot2)
library(data.table)

dt = data.table(x = c(1, 2), ymin = c(1,0), ymax = c(2, 1.3), size = c(1, 2))

p <- ggplot()
p <- p + geom_linerange(data = dt, aes(x = x, ymin = ymin, ymax = ymax, size = as.factor(size)))
p <- p + scale_size_discrete(range = c(1, 2), guide = guide_legend(title="I   want to rotate the lines (symbols) by 90 degree"))

p

线条的宽度具有重要意义,我想在图例中反映出来,但是我想使用垂直线而不是水平线。

您有任何想法吗,小图显示了我想要的东西,我只是为了演示目的而更改了符号的颜色:-)

在此处输入图片说明

使用来自github的ggplot2的当前开发版本解决了我的问题:-) 在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM