ggplot2: One legend with two visual properties derived from common variable

孤人 提交于 2019-12-05 02:36:16

The colorbar cannot be merged, but a normal legend can,

p + guides(colour = guide_legend())
TheRealDJ

I needed to make the labels for size and color the same, and make sure it's working with the same information combined with the guides line.

p+geom_jitter(data=df, aes(x=x, y=y, color=value, size = value)) 
+scale_size_continuous(name = "Legend Name", breaks= c(.25, .50,.75), labels=c(".25",".50",".75"))+scale_colour_gradient(name = "Legend Name", breaks= c(.25, .50,.75), labels=c(".25", ".50",".75"))+ 
guides(colour = guide_legend())
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!