plotly.express.trendline_functions package¶
The trendline_functions module contains functions which are called by Plotly Express
when the trendline argument is used. Valid values for trendline are the names of the
functions in this module, and the value of the trendline_options argument to PX
functions is passed in as the first argument to these functions when called.
Note that the functions in this module are not meant to be called directly, and are exposed as part of the public API for documentation purposes.
-
plotly.express.trendline_functions.ewm(trendline_options, x_raw, x, y, x_label, y_label, non_missing)¶ Exponentially Weighted Moment (EWM) trendline function
The value of the
functionkey of thetrendline_optionsdict is the function to use (defaults tomean) and the value of thefunction_argskey are taken to be its arguments as a dict. The remainder of thetrendline_optionsdict is passed as keyword arguments into thepandas.Series.ewmfunction.
-
plotly.express.trendline_functions.expanding(trendline_options, x_raw, x, y, x_label, y_label, non_missing)¶ Expanding trendline function
The value of the
functionkey of thetrendline_optionsdict is the function to use (defaults tomean) and the value of thefunction_argskey are taken to be its arguments as a dict. The remainder of thetrendline_optionsdict is passed as keyword arguments into thepandas.Series.expandingfunction.
-
plotly.express.trendline_functions.lowess(trendline_options, x_raw, x, y, x_label, y_label, non_missing)¶ LOcally WEighted Scatterplot Smoothing (LOWESS) trendline function
Requires
statsmodelsto be installed.Valid keys for the
trendline_optionsdict are:frac(float, default0.6666666): thefracparameter from the
statsmodels.api.nonparametric.lowessfunction
-
plotly.express.trendline_functions.ols(trendline_options, x_raw, x, y, x_label, y_label, non_missing)¶ Ordinary Least Squares (OLS) trendline function
Requires
statsmodelsto be installed.This trendline function causes fit results to be stored within the figure, accessible via the
plotly.express.get_trendline_resultsfunction. The fit results are the output of thestatsmodels.api.OLSfunction.Valid keys for the
trendline_optionsdict are:add_constant(bool, defaultTrue): ifFalse, the trendline passes through
the origin but if
Truea y-intercept is fitted.log_xandlog_y(bool, defaultFalse): ifTruethe OLS is computed with
respect to the base 10 logarithm of the input. Note that this means no zeros can be present in the input.
-
plotly.express.trendline_functions.rolling(trendline_options, x_raw, x, y, x_label, y_label, non_missing)¶ Rolling trendline function
The value of the
functionkey of thetrendline_optionsdict is the function to use (defaults tomean) and the value of thefunction_argskey are taken to be its arguments as a dict. The remainder of thetrendline_optionsdict is passed as keyword arguments into thepandas.Series.rollingfunction.
