[英]Customize legend for continuous size in ggplot2
I was trying to emphasize some specific size as a reference in my legend.我试图在我的传说中强调一些特定的尺寸作为参考。 I tried
scale_size_continuous
and scale_size_manual
without any luck.我试过
scale_size_continuous
和scale_size_manual
没有任何运气。 Below is a toy example, is there anyone who can help with it?下面是一个玩具示例,有没有人可以帮忙?
set.seed(926)
dat.toy <- data.frame(x1 = rnorm(100),
x2 = rnorm(100),
x3 = factor(sample(1:5,100,replace = T)),
x4 = factor(sample(1:4,100,replace = T)))
require(ggplot2)
ggplot(dat.toy,aes(x=x3,y=x4,colour = x1, size = x2)) +
geom_point()
The desired result should be able to customize (amplify or shrink) the size of the circle, add the size of the circle for -3
, delete (hide) the size of the circle for 2
in the legend.期望的结果应该能够自定义(放大或缩小)圆圈的大小,在图例中添加
-3
的圆圈大小,删除(隐藏) 2
的圆圈大小。
Thanks in advance.提前致谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.