diagnostic.plot_utils#
Functions
|
Decorator to set the default keyword arguments for the plotting function. |
- _augment_kwargs(def_kwargs, **kwargs)[source]#
Augment the user provided keyword arguments with the default plot keyword arguments, subplot keyword arguments and colorbar keyword arguments.
- Parameters:
def_kwargs (dict) – Default plot keyword arguments for the plotting function. subplot_kws and cbar_kwargs can also be set and will also be augmented to the user provided subplot_kws and cbar_kwargs.
kwargs (dict) – User provided keyword arguments.
- Returns:
Augmented keyword arguments.
- Return type:
dict
- 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’.