gcpy.plot.core
Common variables and functions used by modules in gcpy.plot.
Functions
|
Normalizes a data range to the colormap range used by matplotlib functions. |
|
Returns the names of the subplots for the 6-panel plots. |
|
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.
- 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: Falselog_color_scale (
bool, optional) – Logical flag to denote that we are using a logarithmic color scale instead of a linear color scale. Default value: Falseratio_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:
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:
ax (
matplotlib.axes.Axes) – Matplotlib Axes object.text (
matplotlib.text.Text) – Text object that is being plotted.
- Returns:
width_in_data_units – Length of the text label in data units.
- Return type: