1

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?

ThatCrazyCow
  • 469
  • 2
  • 5
  • 17

1 Answers1

1

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

Duck
  • 39,058
  • 13
  • 42
  • 84