Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameter to control the lowess trendline level of adjustment #3202

Closed
GitHunter0 opened this issue May 25, 2021 · 3 comments
Closed

Add parameter to control the lowess trendline level of adjustment #3202

GitHunter0 opened this issue May 25, 2021 · 3 comments

Comments

@GitHunter0
Copy link

Sometimes the lowess trendline gives a poor fit to the points.

Would you consider adding a parameter to control the level of adjustement?

What would solve the problem is the equivalent to the parameter frac of statsmodels.nonparametric.smoothers_lowess.lowess() function.

This is expressed in this Stack Overflow question:
https://stackoverflow.com/questions/67189101/how-to-adjust-plotly-express-lowess-trendline-parameters

Thank you

@GitHunter0 GitHunter0 changed the title Add parameter to tweak lowess trendline parameters Add parameter to control the lowess trendline level of adjustment May 25, 2021
@nicolaskruchten
Copy link
Contributor

Yep, this is a good idea and I've got a mostly-working implementation here #2997 ... just need to find time to QA and merge it :)

@GitHunter0
Copy link
Author

Awesome, I'm glad to know, thank you

@GitHunter0
Copy link
Author

Closing, since now that can be done as below.
OBS: trendline="lowess" requires 'date' to be in datetime format, otherwise date can be a date string.

import plotly.express as px
px.scatter(data_frame = df, 
           x = "date", 
           y = "y",
           trendline="lowess",
           trendline_options=dict(frac=0.2))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants