atmospy.regplot#

atmospy.regplot(data, x, y, fit_reg=True, color=None, marker='o', ylim=None, **kwargs)#

Plot data and a best-fit line (OLS) between two variables.

This figure is intended to convey the relationship between two variables. Often, this may be an air sensor and a reference sensor. It can also be two different variables where you are trying to understand the relationship. This function is a straight pass-through to Seaborn’s jointplot with a few additions such as a unity line and explicitly listing the fit parameters of a linear model (Ordinary Least Squares).

Since it is directly passed through to Seaborn’s jointplot, it is incredibly customizable and powerful. Please see the Seaborn docs for more details.

Parameters:
datapandas.DataFrame

Tabular data as a pandas DataFrame. This should be a wide-form dataset where the x and y keys are columns in the DataFrame.

xkey in data

Variable that corresponds to the data plotted on the x axis.

ykey in data.

Variable that corresponds to the data plotted on the y axis.

fit_regbool, optional

If True, a linear regression model will be fit to the data and fit parameters listed in the legend, by default True

colorstr, optional

A single color to map to the data; if None, the next color in the color cycle will be used, by default None

markerstr, optional

A single marker style to use to plot the data, by default “o”

ylimtuple of floats, optional

Set the limits of the figure on both axes using the ylim (the plot is forced to be squared); if left as None, defaults will be determined from the underlying data, by default None

kwargsdict or None, optional

Additional keyword arguments are passed directly to the underlying seaborn.jointplot call.

Returns:
seaborn.JointGrid

An object with multiple subplots including the joint (primary) and marginal (top and right) axes.

Examples

Using defaults, plot the relationship between a reference particle monitor and an air sensor:

>>> df = atmospy.load_dataset("air-sensors-pm")
>>> atmospy.regplot(df, x="Reference", y="Sensor A")