How to remove stroke from smallest points with geom_count?

737 Views Asked by At

I'm trying to use geom_count() to size points on a ggplot by their occurrence frequency, but for some reason the smallest points end up having black strokes. I've tried different shapes, stroke = 0, everything, but I can't figure this out. I'd really appreciate any help!

Reprex:

library(ggplot2)

frame = data.frame(X = sample(1:7,100,replace=T),
                   Y = sample(1:7,100,replace=T))

ggplot(data = frame, aes(X, Y)) +
  scale_color_grey(start = .6, end = .2) +
  geom_point() +
  geom_count(aes(color = as.factor(..n..)))

Example:

The smallest dots have strokes?

1

There are 1 best solutions below

2
On BEST ANSWER

This can help:

library(ggplot2)
#Code
ggplot(data = frame, aes(X, Y)) +
  scale_color_grey(start = .6, end = .2) +
  geom_point(shape=21,color='transparent') +
  geom_count(aes(color = as.factor(..n..)))

Output:

enter image description here

Or only:

#Code 2
ggplot(data = frame, aes(X, Y)) +
  scale_color_grey(start = .6, end = .2) +
  geom_point(color='transparent') +
  geom_count(aes(color = as.factor(..n..)))

Output:

enter image description here