Reputation: 5819
If you look at the screen grab below you'll see that five rows of my geom_hex
have a white border that make the plot look goofy. Why is this? How do I stop it? When I save with ggsave
the problem gets worse (more white lines)!
library(tidyverse)
ggplot(diamonds, aes(carat, price)) + geom_hex(bins = 50)
ggsave("geom_hex.png")
Upvotes: 2
Views: 955
Reputation: 1175
By default geom_hex
only fills the hexagons and not their contours. Add a contour line (a "colour" in ggplot-speak) coloured with the same colour scale and that will fill the voids :
library(tidyverse)
ggplot(diamonds, aes(carat, price)) +
geom_hex(aes(colour = ..count..), bins = 50)
Upvotes: 6