gcpy.plot.core

Common variables and functions used by modules in gcpy.plot.

Functions

normalize_colors(vmin, vmax[, ...])

Normalizes a data range to the colormap range used by matplotlib functions.

six_panel_subplot_names(diff_of_diffs)

Returns the names of the subplots for the 6-panel plots.

text_to_data_units(ax, text)

Computes the width of a label in data units.

gcpy.plot.core.six_panel_subplot_names(diff_of_diffs)[source]

Returns the names of the subplots for the 6-panel plots.

Parameters:

diff_of_diffs (bool) – Indicates if this is a diff-of-diffs benchmark (True) or not (False). Ratio plots are only included if diff_of_diffs is False.

Returns:

subplots – List of names of each of the subplots in the 6-panel plot.

Return type:

list of str

gcpy.plot.core.normalize_colors(vmin, vmax, is_difference=False, log_color_scale=False, ratio_log=False)[source]

Normalizes a data range to the colormap range used by matplotlib functions. For log-color scales, special handling is done to prevent taking the log of data that is all zeroes.

Parameters:
  • vmin (float) – Minimum value of the data range.

  • vmax (float) – Maximum value of the data range.

  • is_difference (bool, optional) – Set this switch to denote that we are using a difference color scale (i.e. with zero in the middle of the range). Default value: False

  • log_color_scale (bool, optional) – Logical flag to denote that we are using a logarithmic color scale instead of a linear color scale. Default value: False

  • ratio_log (bool, optional) – Indicates whether we are using log scaling for ratio plots (True) or not (False). Default value: False

Returns:

norm – The normalized matplotlib color range, stored in a matplotlib Normalize object.

Return type:

matplotlib.colors.Normalize

Notes

For log color scales, we will use a range of 3 orders of magnitude (i.e. from vmax/1e3 to vmax).

gcpy.plot.core.text_to_data_units(ax, text)[source]

Computes the width of a label in data units.

Parameters:
Returns:

width_in_data_units – Length of the text label in data units.

Return type:

float