R 使用“密度”使用ggplot设置点的颜色和大小

R 使用“密度”使用ggplot设置点的颜色和大小,r,ggplot2,R,Ggplot2,我只想设置点的颜色和大小。 我已经找到了不少帖子,但没有一篇是我能够反向工程的。 可能吗 require(ggplot2) d <- ggplot(diamonds, aes(price)) #+ xlim(0, 3) d + stat_bin(aes(size = ..density.., color=..density..), binwidth = 0.1,geom = "point", position="jitter") +

我只想设置点的颜色和大小。 我已经找到了不少帖子,但没有一篇是我能够反向工程的。 可能吗

require(ggplot2)
d <- ggplot(diamonds, aes(price)) #+ xlim(0, 3)
d + stat_bin(aes(size = ..density.., color=..density..),
             binwidth = 0.1,geom = "point",
             position="jitter")  +
     guides(col = guide_legend(override.aes = list(shape = 15, size = 10)))
require(ggplot2)

d这会在我的设备上生成一个没有错误的绘图:

d + stat_bin(aes(size = ..density.., color= ..density..), 
             binwidth = 0.1,geom = "point", position="jitter") 
如果你需要一些不同的东西,你应该弄清楚这些不同可能是什么

d + stat_bin(aes(size = ..density.., color= ..density..), 
             binwidth = 0.1,geom = "point", position="jitter")