I simply want a scatterplot where each point is scaled by size and fill for different variables. I've read just about everywhere about this and I realize the default shape is hollow (I've changed it to 19, which is solid). I want the color and fill to be the same so each point has 1 color, 1 size, 1 x-y coord rather than the donut look its got going on. The separation of color and fill is frustrating me to no end... Here's the code:
我只想要一个散点图,其中每个点按大小缩放并填充不同的变量。我几乎到处都读过这个,我发现默认的形状是空心的(我把它改成了19,这是实心的)。我希望颜色和填充是相同的,所以每个点有1种颜色,1个尺寸,1 x-y坐标而不是甜甜圈外观。颜色和填充的分离令我感到沮丧,无处不在......以下是代码:
ggplot(data, aes(period,freq))+
geom_point(shape=19,aes(size=copies,fill=total_len,colour=total_len))+
scale_fill_gradient(low="blue",high="red")+
scale_colour_gradient(low="blue",high="red")
1 个解决方案
#1
1
I think all you need is
我想你需要的只是
ggplot(data, aes(period, freq, size=copies, color=total_len)) +
geom_point() +
scale_color_gradient(low="blue", high="red")
#1
1
I think all you need is
我想你需要的只是
ggplot(data, aes(period, freq, size=copies, color=total_len)) +
geom_point() +
scale_color_gradient(low="blue", high="red")