I'm trying to create a line from my Y point to Y=0 for each of my data points. My Y axis is "stat(count)", which seems to be creating problems when I add "geom_segment". This works to create my graph:
ggplot(my_data, aes(x = X, y = stat(count))) +
theme_minimal() + stat_count(geom = "point") +
ylim(0,4) +
scale_x_continuous(breaks = seq(0,457,50))
However, when I add in
geom_segment(aes(xend=X, yend=0))
I get the following error:
"Error: Aesthetics must be valid computed stats. Problematic aesthetic(s): y = stat(count). Did you map your stat in the wrong layer?"