dfrankow dfrankow - 10 days ago 12
R Question

ggplot warning: Ignoring unknown aesthetics: ymin, ymax

I am getting an error I can't figure out. This may well be something dumb, like a misspelling or missing parens, but I can't see it.

My plot command:

ggplot(df, aes(flim, flam, group=1)) +
geom_point(aes(size=foo)) + geom_line() +
geom_smooth(stat='identity', aes(ymin=flam - flam_c95,
ymax=flam + flam_c95))


I get:

Warning: Ignoring unknown aesthetics: ymin, ymax


Without the geom_smooth, no warning. flam and flam_c95 exist in df. I have done this before plenty of times. What am I missing?

I am using R 3.2.4, ggplot 2.2.0 which warns it was built for R 3.2.5.

Answer

You can use geom_ribbon in place of geom_smooth with stat = "identity" to draw intervals around your line.

geom_ribbon(aes(ymin=flam - flam_c95, ymax=flam + flam_c95))
Comments