has2k1 / plotnine

A Grammar of Graphics for Python
https://plotnine.org
MIT License
3.92k stars 210 forks source link

geom_smooth not showing error bars in example #748

Closed fkgruber closed 5 months ago

fkgruber commented 5 months ago

The example plot for geom_smooth is not showing the error bars (https://www.plotnine.org/generated/plotnine.geoms.geom_smooth.html#plotnine.geoms.geom_smooth)


from plotnine import (
    ggplot,
    aes,
    geom_point,
    geom_smooth,
    labs
)
from plotnine.data import mpg
(
    ggplot(mpg, aes(x='displ', y='hwy'))
    + geom_point()
    + geom_smooth(span=.3)
    + labs(x='displacement', y='horsepower')
)

I also get the message:

/Users/me/miniconda3/envs/mhcflurry/lib/python3.10/site-packages/plotnine/stats/smoothers.py:330: PlotnineWarning: Confidence intervals are not yet implemented for lowess smoothings.

image
has2k1 commented 5 months ago

You need to install scikit-misc which provides loess smoothing which has intervals implemented.

fkgruber commented 5 months ago

thanks