I would expect the following snippet to print the 95% confidence intervals of the length of the sepals:
ggplot(iris,aes(x=Species,y=Sepal.Length)) +
stat_summary(geom='ribbon',
fun=mean_cl_normal,
fun.args=list(conf.int=0.95))
Which additional diagnostics could I run to elucidate why the plot stays empty?
Edit:
I was using the 'ribbon' geometry, because it would be important for me to indicate the confidence intervals as a shaded area.
For a categorical x variable, the 'ribbon' geometry doesn't make too much sense, as suggested in the helpful answers.
Indeed, my variable on the x axis is actually continuous and I had been a bit unfortunate in choosing the iris
dataset as a minimal reproducible example.
It would therefore make more sense to choose a minimal example like the following:
ggplot(data.frame(x=rep(1:3,each=3),y=c(1:3,4:6,7:9))) +
stat_summary(aes(x=x,y=y),
geom='ribbon',
fun=mean_cl_normal,
fun.args=list(conf.int=0.95))