ggplot alpha levels appear different on fill and border of points (ringing artefact)
Given that you want disks with constant colour & opacity simplest thing to do that fixed it for me, also in the RStudio plot preview window is just to use option shape=16
:
data <- data.frame( x = sample(1:100,2000, replace=T),
y = sample(1:100,2000, replace=T) )
ggplot(d, aes(x,y)) +
geom_point(alpha=0.2, color="dodgerblue", size=5, shape=16) +
theme(panel.background = element_rect(fill = 'black', colour = 'black'))
Alternatively, shape=21
and a 100% semitransparent fill with
fill=adjustcolor("dodgerblue",alpha.f=0)
also works:
ggplot(data, aes(x,y)) +
geom_point(alpha=0.2, fill=adjustcolor("dodgerblue",alpha.f=0), size=5, shape=21) +
theme(panel.background = element_rect(fill = 'black', colour = 'black'))
Using stroke=0
as suggested in the currently accepted answer doesn't seem to resolve the problem entirely for me (ringing effect goes away a little bit but not entirely, this is on Windows at least) :
ggplot(data, aes(x,y)) +
geom_point(alpha=0.2, colour="dodgerblue", fill="dodgerblue", stroke=0, size=5) +
theme(panel.background = element_rect(fill = 'black', colour = 'black'))
Changing stroke to 0 seems to have hte desired result:
ggplot(data, aes(x,y)) +
geom_point(alpha=0.2, colour="dodgerblue", fill=mycol, stroke=0, size=5) +
theme(panel.background = element_rect(fill = 'black', colour = 'black'))