geocat.viz.taylor.TaylorDiagram#

class geocat.viz.taylor.TaylorDiagram(refstd=1, fig=None, rect=111, label='REF', std_range=(0, 1.65), std_level=array([0., 0.25, 0.5, 0.75, 1., 1.25, 1.5]))#

Taylor Diagram.

Taylor diagrams provide a visual framework for comparing a suite of variables from one or more test data sets to one or more reference data sets. Commonly, the test data sets are model experiments while the reference data set is a control experiment or some reference observations (eg, ECMWF Reanalyses). Generally, the plotted values are derived from climatological monthly, seasonal or annual means. Because the different variables (eg: precipitation, temperature) may have widely varying numerical values, the results are normalized by the reference variables. The ratio of the normalized variances indicates the relative amplitude of the model and observed variations.

Parameters:
  • refstd (float) – Optional reference standard deviation

  • fig (matplotlib.figure.Figure) – Optional input figure. Default is None

  • rect (int) – Optional subplot definition

  • label (str) – Optional reference label string indentifier

  • stdRange (tuple) – Optional stddev axis extent

  • stdLevel (list) – Optional list of tick locations for stddev axis

Notes

Rendering of Taylor Diagrams looks best with a figure that is at least 10x10 inches. If you make your figure size too small, legends, lagels, and other text items might overlap in undesired ways.

References

Methods

__init__([refstd, fig, rect, label, ...])

Create base Taylor Diagram.

add_bias_legend()

Add bias legend to the upper left hand corner.

add_contours([levels])

Add constant centered RMS difference contours.

add_corr_grid(arr[, color, linestyle, linewidth])

Add gridlines to the correlation axis specified by array arr

add_grid(*args, **kwargs)

Add a grid.

add_legend([xloc, yloc, loc, fontsize])

Add a figure legend.

add_model_name(namearr[, x_loc, y_loc, ...])

Add texts of model names.

add_model_set(stddev, corrcoef[, fontsize, ...])

Add a model set (stddev, corrcoeff) to the Taylor diagram.

add_std_grid(arr[, color, linestyle, linewidth])

Add radial gridlines to the standard deviation axis specified by array.

add_title(maintitle[, fontsize, y_loc])

Add a main title.

add_xgrid(arr[, color, linestyle, linewidth])

Add gridlines to the correlation axis specified by array arr.

add_ygrid(arr[, color, linestyle, linewidth])

Add gridlines to the standard deviation axis specified by array.

set_fontsizes_and_pad([ticklabel_fontsize, ...])

Reset ticklabel and axis label fontsizes, and axis label padding.

add_bias_legend()#

Add bias legend to the upper left hand corner.

Examples

All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the website.

add_contours(levels=5, **kwargs)#

Add constant centered RMS difference contours.

Parameters:

levels (xarray.DataArray, numpy.ndarray, list, int) – Determines the number and positions of the contour lines. Optional. Default to 5

Notes

args and kwargs are propagated to matplotlib.axes.Axes.contour

Returns:

contours (matplotlib.contour.QuadContourSet) – Matplotlib Contour Object

Examples

All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the website.

add_corr_grid(arr, color='lightgray', linestyle=(0, (9, 5)), linewidth=0.5, **kwargs)#

Add gridlines to the correlation axis specified by array arr

Parameters:
  • arr (xarray.DataArray, numpy.ndarray, list, float) – An array of horizontal coordinates of the data points that denote correlation

  • color (str) – Color of the gridline. Optional. Default to “lightgray”

  • linestyle ({'-', '--', '-.', ':', '', (offset, on-off-seq), ...}) – See matplotlib Linestyle examples. Optional. Default to (0, (9,5))

  • linewidth (float) – Set the line width in points. Optional. Default to 0.5

Notes

kwargs are directly propagated to the matplotlib.axes.Axes.vlines command.

Returns:

None

Examples

All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the website.

add_grid(*args, **kwargs)#

Add a grid.

Notes

args and kwargs are propagated to matplotlib.axes.Axes.grid

add_legend(xloc=1.1, yloc=0.95, loc='upper right', fontsize=14, **kwargs)#

Add a figure legend.

The coordinate system is Axes(transAxes). (x_loc=0, y_loc=0) is bottom left of the axes, and (x_loc=1, y_loc=1) is top right of the axes.

Parameters:
  • xloc (float) – x location of legend position, supplied to bbox_to_anchor(). Optional. Default to 1.1

  • yloc (float) – y location of legend position, upplied to bbox_to_anchor(). Optional. Default to 0.95

  • loc (str) – See Matplotlib legend documentations. Optional. Default to ‘upper right’

  • fontsize (float) – Text fontsize. Optional. Default to 14

Notes

kwargs are directly propagated to the matplotlib.axes.Axes.legend command kwargs are directly propagated to the matplotlib.pyplot.legend command.

Returns:

legend (matplotlib.legend.Legend) – Matplotlib legend object

Examples

All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the website.

add_model_name(namearr, x_loc=0.1, y_loc=0.31, verticalalignment='top', fontsize=13, **kwargs)#

Add texts of model names.

The coordinate system of the Axes(transAxes) is used for more intuitive positioning of the texts. (x_loc=0, y_loc=0) is bottom left of the axes, and (x_loc=1, y_loc=1) is top right of the axes.

Parameters:
  • namearr (xarray.DataArray, numpy.ndarray, list) – List of model names

  • x_loc (float) – x component of text position. Optional. Default to 0.1

  • y_loc (float) – y component of text position. Optional. Default to 0.31

  • verticalalignment (str) – Vertical alignment. Options: {‘center’, ‘top’, ‘bottom’, ‘baseline’, ‘center_baseline’}. Optional. Default to ‘top’

  • fontsize (float) – Text fontsize. Optional. Default to 13

Notes

kwargs are directly propagated to the matplotlib.axes.Axes.text command

Returns:

None

Examples

All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the website.

add_model_set(stddev, corrcoef, fontsize=14, xytext=(-5, 7), annotate_on=True, model_outlier_on=False, percent_bias_on=False, bias_array=None, *args, **kwargs)#

Add a model set (stddev, corrcoeff) to the Taylor diagram. NCL- style model markers and labels are achieved through Matplotlib markers and annotations. xytext argument can be used to adjust the positioning of the label relative to the markers if annotate_on argument is set to True.

Parameters:
  • stddev (xarray.DataArray, numpy.ndarray, list) – An array of vertical coordinates of the data points that denote the standard deviation

  • corrcoef (xarray.DataArray, numpy.ndarray, list) – An array of horizontal coordinates of the data points that denote correlation Input should have the same size as stddev

  • fontsize (float) – Fonsize of marker labels. This argument is suplied to matplotlib.axes.Axes.annotate command. Optional. Default value 14.

  • xytext (tuple(float, float)) – The position (x, y) to place the marker label at. The coordinate system is set to pixels. This argument is supplied to matplotlib.axes.Axes.annotate command. Optional. Default set to (-5,7)

  • annotate_on (bool) – Determine whether model labels are added. Optional. Default to True.

  • model_outlier_on (bool) – If True, models with negative correlations and standard deviations > TaylorDiagram.smax(default to 1.65) are plotted as text at the bottom of the figure; if False, all models are plotted according to stddev and corrcoef Default to False. Optional.

  • percent_bias_on (bool) – If True, model marker and marker size is plotted based on bias_array Default to False. Optional.

  • bias_array (xarray.DataArray, numpy.ndarray, list) – If this is given, it is used to determine individual marker size and marker style internally. Input should have the same size as stddev and corrcoef Default to None.

Notes

args and kwargs are directly propagated to the matplotlib.axes.Axes.plot command.

Returns:

Examples

All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the website.

add_std_grid(arr, color='lightgray', linestyle=(0, (9, 5)), linewidth=1, **kwargs)#

Add radial gridlines to the standard deviation axis specified by array.

arr

Parameters:
  • arr (xarray.DataArray, numpy.ndarray, list, float) – An array of vertical coordinates of the data points that denote standard deviation

  • color (str) – Color of the gridline. Optional. Default to “lightgray”

  • linestyle ({'-', '--', '-.', ':', '', (offset, on-off-seq), ...}) – See matplotlib Linestyle examples. Optional. Default to (0, (9,5))

  • linewidth (float) – Set the line width in points. Optional. Default to 1

Notes

kwargs are directly propagated to the matplotlib.axes.Axes.plot command.

Returns:

None

Examples

All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the website.

add_title(maintitle, fontsize=18, y_loc=None, **kwargs)#

Add a main title.

Parameters:
  • maintitle (str) – Title text

  • fontsize (float) – Text fontsize. Optional. Defaults to 18

  • y_loc (float) – Vertical Axes location. 1.0 is the top. Optional. Default to None

Notes

kwargs are directly propagated to the matplotlib.axes.Axes.set_title command.

Returns:

None

Examples

All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the website.

add_xgrid(arr, color='lightgray', linestyle=(0, (9, 5)), linewidth=0.5, **kwargs)#

Add gridlines to the correlation axis specified by array arr.

This method will be deprecated in favor of TaylorDiagram.add_corr_grid()

add_ygrid(arr, color='lightgray', linestyle=(0, (9, 5)), linewidth=1, **kwargs)#

Add gridlines to the standard deviation axis specified by array.

arr.

This method will be deprecated in favor of TaylorDiagram.add_std_grid()

set_fontsizes_and_pad(ticklabel_fontsize=14, axislabel_fontsize=16, axislabel_pad=8)#

Reset ticklabel and axis label fontsizes, and axis label padding.

Parameters:
  • ticklabel_fontsize (float) – Fontsize of all tick labels. Optional. Default to 14

  • axislabel_fontsize (float) – Fontsize of axis labels. Optional. Default to 16

  • axislabel_pad (float) – Padding between axis labels and axis. Optional. Default to 8

Returns:

None

Examples

All usage examples are within the GeoCAT-Examples Gallery. To see more usage cases, search the function on the website.