I made a scatter plot by ggplot2 like it
but I want to color the density of the dots, I tried adding alpha value but it can not indicate the density well. So how to color the overlapping dots based on their counts?
The data I used looks contain 0.1 million numbers(range from 0 to 1) like this (the first column is x and the second is y):
0.07 0.04
0.02 0.12
0.00 0.03
0.14 0.10
I added alpha value and the plot looks like:
The code:
library(ggplot2)
p <- ggplot(file, aes(X1,X2)) + geom_point(size=1,alpha = 0.1)
p + labs(x= " " , y=" ", title=" ") + xlim(0.0,1.0) + ylim(0.0,1.0)
?dput
– loki