You can't easily do this in ggplot
, because rounded lines extend beyond the normal "limits" of the line:
ggplot(mtcars, aes(x = factor(cyl), xend = factor(cyl), yend = stat(count) - stat(count))) +
stat_count(geom = 'segment', size = 50)
ggplot(mtcars, aes(x = factor(cyl), xend = factor(cyl), yend = stat(count) - stat(count))) +
stat_count(geom = 'segment', size = 50, lineend = 'round')