solarwindpy.fitfunctions.plots.FFPlotο
- class FFPlot(observations, y_fit, TeX_info, fit_result, fitfunction_name='')[source]ο
Bases:
object- __init__(observations, y_fit, TeX_info, fit_result, fitfunction_name='')[source]ο
Container for plotting a
FitFunction.- Parameters:
observations (
Observations) β Observed data used in the fit.y_fit (array-like) β Model evaluated at the observed
xvalues.TeX_info (
TeXinfo) β Object describing the fit for annotation.fit_result (scipy.optimize.OptimizeResult) β Result object returned from the fitting routine.
fitfunction_name (str, optional) β Name of the originating fit function.
- property labelsο
- property logο
- property observationsο
- property fitfunction_nameο
- property fit_resultο
- property pathο
- property TeX_infoο
- property y_fitο
- plot_raw(ax=None, plot_window=True, edge_kwargs=None, **kwargs)[source]ο
Plot the observations used in the fit from raw data.
Plot from
self.observations.raw.x(),self.observations.raw.y(),self.observations.raw.w().- Parameters:
edge_kwargs (None, dict) β If not None, plot edges on the window using these kwargs.
- plot_used(ax=None, plot_window=True, edge_kwargs=None, **kwargs)[source]ο
Plot the observations used in the fit from used data.
Plot from
self.observations.used.x(),self.observations.used.y(), andself.observations.used.w().
- plot_raw_used_fit(ax=None, drawstyle=None, annotate=True, raw_kwargs=None, used_kwargs=None, fit_kwargs=None, annotate_kwargs=None)[source]ο
Make a plot of the raw observations, observations in fit, and the fit.
Combines the outputs of
self.plot_raw(),self.plot_used(), andself.plot_fit().- Parameters:
ax (None, mpl.Axes.axis_subplot)
drawstyle (str, None) β mpl drawstyle, shared by
self.plot_raw()andself.plot_used(). If None, defaults to βsteps-midβ.annotate (True) β If True, add fit info to the annotation using ax.text.
raw_kwargs (dict) β Passed to ax.plot(**kwargs) in
self.plot_raw().used_kwargs (dict) β Passed to ax.plot(**kwargs) in
self.plot_used().fit_kwargs (dict) β Passed to ax.plot(**fit_kwargs) for plotting fit.
annotate_kwargs β Passed to ax.text.
- Returns:
ax
- Return type:
mpl.Axes.axis_subplot
- plot_residuals(ax=None, pct=True, subplots_kwargs=None, kind='both', **kwargs)[source]ο
Plot residuals for the data used in the fit.
Residuals are shown on a symlog scale with
linthresh=10. By default they are expressed as percentages of the fitted model.- Parameters:
ax (mpl.axes.Axes, optional) β Axis to draw on. If
Nonea new figure and axis are created.pct (bool, default True) β If
True, show residuals as percentages.subplots_kwargs (dict, optional) β Passed to
plt.subplotswhenaxisNone.kind ({'simple', 'robust', 'both'}, default "both") β Which residuals to plot.
**kwargs β Additional keyword arguments passed to
ax.plot.
- Returns:
ax β Axis with residuals plotted.
- Return type:
mpl.axes.Axes
- plot_raw_used_fit_resid(annotate=True, fit_resid_axes=None, figsize=(6, 4), resid_kwargs=None, **kwargs)[source]ο
Make a stacked fit, residual plot.
- Parameters:
annotate (bool) β If True, add fit annotation to axis.
fit_resid_axes (None, 2-tuple of mpl.axis.Axis) β If not None, (fit, resid) axis pair to plot the (raw, used, fit) and residual on, respectively. Otherwise, use GridSpec to build a pair of axes where the raw_used_fit axis is 3 times the resid_axis. Additionally, if fit_resid_axes is None, the hax and rax will share an x-axis and haxβs x-ticks and label will be set invisible.
figsize β Any valid argument for
plt.figure(figsize=figsize)(). This code was developed with default size 6x4 and this size helps accomodate annotation. So we persist it here.resid_kwargs (dict, None) β Passed to
{self.__class__.__name__}.plot_residuals().kwargs β Passed to
{self.__class__.__name__}.plot_raw_used_fit().
- Returns:
hax (mpl.axis.Axis) β Axis with raw observations, used observations, and fit plotted on it.
rax (mpl.axis.Axis) β Axis with residuals plotted on it.
- residuals(pct=False, robust=False)[source]ο
Calculate the fit residuals.
If pct, normalize by fit yvalues.
- set_labels(**kwargs)[source]ο
Set or update x, y, or z labels.
Any label not specified in kwargs is propagated from self.labels.<x, y, or z>.