-
Notifications
You must be signed in to change notification settings - Fork 245
Closed
Labels
Description
Hi,
I am sorry if this isn't the place for such a question, but I couldn't find any better place to post it to. I need to create a quadratic regression line. In ggplot2 I would add "formula = y ~ poly(x,degree=2)" after "method=lm", how should this be done in plotnine if it is at all possible?
# (if necessary data available here: https://raw.githubusercontent.com/luketudge/stats-tutorials/master/tutorials/data/penguins.csv)
from plotnine import ggplot, geom_point, aes, stat_smooth
import pandas as pd
penguin = pd.read_csv('penguins.csv')
# plot
(ggplot(p, aes('HeartRate', 'Duration'))
+ stat_smooth(method = 'lm')
+ geom_point()
+ labs(y = 'Heart rate (bpm)', x = 'Duration (minutes)'))
Thank you!
Martin
Reactions are currently unavailable