diagnostic.plot_utils.default_plot_kwargs#

default_plot_kwargs(kwargs)[source]#

Decorator to set the default keyword arguments for the plotting function. User will override and/or be augmented with the default keyword arguments. subplot_kws and cbar_kwargs can also be set as default keyword arguments for the plotting function.

Parameters:

kwargs (dict) – Default keyword arguments for the plotting function. Can also include subplot_kws and cbar_kwargs as dictionarys in the kwargs dictionary.

Examples

The following example sets the default colorbar orientation to horizontal for the plotting function.

>>> @plot_kwarg_defaults({'cbar_kwargs': {'orientation': 'horizontal'}})
... def plot_function(*args, **kwargs):
...     pass

If unspecified by the user, the colorbar orientation will be horizontal. If the user specifies the colorbar orientation, it will override the default orientation. If the user passes cbar_kwargs={‘label’: ‘Label’}, the default orientation will still be horizontal and the label will be ‘Label’.