gfdlvitals.plot module
Standardized plotting routines
- gfdlvitals.plot.on_key(event, fig, varlist, axes_dict, smooth, nyears, trend)
Update plot on keypress of left and right arrow keys
- Parameters:
event (mpl keyboard event) – Key press
fig (matplotlib.pyplot.figure) – Matplotlib figure handle
varlist (list) – List of variables to plot
axes_dict (dict) – Internal structure of axes associations to the data
smooth (int, None type) – Integer number of years to apply as a smoother
nyears (int, None type) – Integer number to years to limit the plotting
trend (bool) – Add linear trend lines if True, omit if False
- gfdlvitals.plot.plot_timeseries(dsets, var, trend=False, align_times=False, plottype='average', smooth=None, nyears=None, labels=None, legend=True, means=True, title='both')
Standardized function to make a timeseries plot
- Parameters:
dsets (gfdlvitals.VitalsDataFrame or list) – Dataframe or list of dataframes to plot
var (str) – Variable name to plot
trend (bool, optional) – Plot linear trend line if True, by default False
align_times (bool, optional) – H, by default False
plottype (str, optional) – Defines plot type as either “average” or “sum”, by default “average”
smooth (int, optional) – Integer number of years to apply smoothing, by default None
nyears (int, optional) – Limit the x-axis to nyears number of points, by default None
labels (str, optional) – Comma-separated list of dataset labels, by default None
legend (bool, optional) – Display a legend for the plot, by default True
means (bool, optional) – Add variable means to the legend, by default True
title (str, optional) – Specify “varname”, “longname”, “both”, or “none”, by default “both”
- Returns:
Matplotlib figure handle and dictionary of axes/dataset mappings
- Return type:
matplotlib.pyplot.figure, dict
- gfdlvitals.plot.run_plotdb(cliargs)
Intermediate function to execute plotting routines
- Parameters:
cliargs (argparse.arguments) – Processed command-line arguments
- gfdlvitals.plot.set_font()
Sets font style to Roboto
- gfdlvitals.plot.update_figure(fig, axes_dict, varname, smooth, nyears, trend)
Update plot on keypress of left and right arrow keys
- Parameters:
fig (matplotlib.pyplot.figure) – Matplotlib figure handle
axes_dict (dict) – Internal structure of axes associations to the data
varname (str) – Variable name to plot
smooth (int, None type) – Integer number of years to apply as a smoother
nyears (int, None type) – Integer number to years to limit the plotting
trend (bool) – Add linear trend lines if True, omit if False
- Returns:
Matplotlib figure handle
- Return type:
matplotlib.pyplot.figure