Plotting functionalities#

Plotting scripts for MLR models input/output.

Description#

This diagnostic creates plots for MLR model input/output.

Author#

Manuel Schlund (DLR, Germany)

Project#

CRESCENDO

Notes

All configuration options starting with plot_ specify keyword arguments for a specific plot type. A certain plot type is only plotted if the corresponding option is given in the recipe (if no additional keyword arguments are desired, use {}).

Configuration options in recipe#

additional_plot_kwargs_xy_plots: dict, optional

Optional keyword arguments (values) for single datasets used in X-Y plots. They keys may include a var_type or values of the attribute given by group_by_attribute.

alias: dict, optional

str to str mapping for nicer plot labels (e.g. {'feature': 'Historical CMIP5 data'}.

apply_common_mask: bool, optional (default: False)

Apply common mask to all datasets prior to plotting. Requires identical shapes for all datasets.

group_attribute_as_default_alias: bool, optional (default: True)

If True, use value of attribute given by group_by_attribute as default alias if possible. If False, use full group name (including var_type) as default alias.

group_by_attribute: str, optional (default: ‘mlr_model_name’)

By default, datasets are grouped using the var_type attribute. This option can be used to specify a further attribute to group datasets. This diagnostic expects a single dataset per group.

ignore: list of dict, optional

Ignore specific datasets by specifying multiple dict s of metadata.

legend_kwargs: dict, optional

Optional keyword arguments of matplotlib.pyplot.legend() (affects only plots with legends).

map_plot_type: str, optional (default: ‘pcolormesh’)

Type of plot used for plotting maps. Must be one of 'pcolormesh' or 'contourf'.

pattern: str, optional

Pattern matched against ancestor file names.

plot_map: dict, optional

Specify additional keyword arguments for plotting global maps showing datasets by plot_kwargs and plot appearance options by pyplot_kwargs (processed as functions of matplotlib.pyplot).

plot_map_abs_biases: dict, optional

Specify additional keyword arguments for plotting global maps showing absolute biases by plot_kwargs and plot appearance options by pyplot_kwargs (processed as functions of matplotlib.pyplot).

plot_map_ratios: dict, optional

Specify additional keyword arguments for plotting global maps showing ratios of datasets by plot_kwargs and plot appearance options by pyplot_kwargs (processed as functions of matplotlib.pyplot).

plot_map_rel_biases: dict, optional

Specify additional keyword arguments for plotting global maps showing relative biases of datasets by plot_kwargs and plot appearance options by pyplot_kwargs (processed as functions of matplotlib.pyplot).

plot_xy: dict, optional

Specify additional keyword arguments for simple X-Y plots by plot_kwargs and plot appearance options by pyplot_kwargs (processed as functions of matplotlib.pyplot). By default, plots data against dimensional coordinate (if available). Use x_coord (str) to use another coordinate as X-axis. Use reg_line: True to additionally plot a linear regression line.

plot_xy_with_errors: dict, optional

Specify additional keyword arguments for X-Y plots with error ranges plot_kwargs and plot appearance options by pyplot_kwargs (processed as functions of matplotlib.pyplot). By default, plots data against dimensional coordinate (if available). Use x_coord (str) to use another coordinate as X-axis.

print_corr: bool, optional (default: False)

Print and save Pearson correlation coefficient between all datasets at the end. Requires identical shapes for all datasets.

savefig_kwargs: dict, optional

Keyword arguments for matplotlib.pyplot.savefig().

seaborn_settings: dict, optional

Options for seaborn.set_theme() (affects all plots).

years_in_title: bool, optional (default: False)

Print years in default title of plots.