我正在使用以下代码制作带有颜色编码密度的散点图:
d1 = densCols(newData_cut,
colramp = colorRampPalette(c("navy
blue","yellow","firebrick","firebrick"),
space = "Lab"))
ggplot(newData_cut) +
geom_point(aes(x=green, y= blue, col = d1), size = 1) +
xlim(0, 0.4)+
ylim(0,2)
但是当我得到图像时,它看起来像这样:
有人可以帮助我用一个代表点数/密度的颜色绘制一个合适的图例吗?
> dput(head(newData_cut))
structure(list(green = c(0, 0.229804, 0, 0, 0, 0), blue = c(0.080264,
0.204474, 0.04059, 0.040284, 0.042421, 0.041505), width = c(1317,
4529, 1, 10, 23, 5)), .Names = c("green", "blue", "width"), row.names =
c(NA,
6L), class = "data.frame")