rhg_compute_tools.design package¶
Submodules¶
rhg_compute_tools.design.colors module¶
rhg_compute_tools.design.plotting module¶
-
rhg_compute_tools.design.plotting.
add_colorbar
(ax, cmap='viridis', norm=None, orientation='vertical', **kwargs)[source]¶ Add a colorbar to a plot, using a pre-defined cmap and norm
Parameters: - ax (object) – matplotlib axis object
- cmap (str or object, optional) –
matplotlib.colors.cmap
instance or name of a registered cmap (default viridis) - norm (object, optional) –
matplotlib.colors.Normalize
instance. default is a linear norm between the min and max of the first plotted object. - orientation (str, optional) – default ‘vertical’
- **kwargs – passed to colorbar constructor
-
rhg_compute_tools.design.plotting.
get_color_scheme
(values, cmap=None, colors=None, levels=None, how=None)[source]¶ Generate a norm and color scheme from data
Parameters: - values (array-like) – data to be plotted, from which to generate cmap and norm. This should be an array, DataArray, etc. that we can use to find the min/max and/or quantiles of the data.
- cmap (str, optional) – named matplotlib cmap (default inferred from data)
- colors (list-like, optional) – list of colors to use in a discrete colormap, or with which to create a custom color map
- levels (list-like, optional) – boundaries of discrete colormap, provide
- how (str, optional) – Optional setting form
{'linear', 'log', 'symlog', None}
. Used to construct the returnednorm
object, which defines the way the colors map to values. By default, we the method is inferred from thevalues
.
Returns: - cmap (object) –
matplotlib.colors.cmap
color mapping - norm (object) –
matplotlib.colors.Normalize
instance using the provided values, levels, color specification, and “how” method
Module contents¶
-
rhg_compute_tools.design.
get_color_scheme
(values, cmap=None, colors=None, levels=None, how=None)[source]¶ Generate a norm and color scheme from data
Parameters: - values (array-like) – data to be plotted, from which to generate cmap and norm. This should be an array, DataArray, etc. that we can use to find the min/max and/or quantiles of the data.
- cmap (str, optional) – named matplotlib cmap (default inferred from data)
- colors (list-like, optional) – list of colors to use in a discrete colormap, or with which to create a custom color map
- levels (list-like, optional) – boundaries of discrete colormap, provide
- how (str, optional) – Optional setting form
{'linear', 'log', 'symlog', None}
. Used to construct the returnednorm
object, which defines the way the colors map to values. By default, we the method is inferred from thevalues
.
Returns: - cmap (object) –
matplotlib.colors.cmap
color mapping - norm (object) –
matplotlib.colors.Normalize
instance using the provided values, levels, color specification, and “how” method
-
rhg_compute_tools.design.
add_colorbar
(ax, cmap='viridis', norm=None, orientation='vertical', **kwargs)[source]¶ Add a colorbar to a plot, using a pre-defined cmap and norm
Parameters: - ax (object) – matplotlib axis object
- cmap (str or object, optional) –
matplotlib.colors.cmap
instance or name of a registered cmap (default viridis) - norm (object, optional) –
matplotlib.colors.Normalize
instance. default is a linear norm between the min and max of the first plotted object. - orientation (str, optional) – default ‘vertical’
- **kwargs – passed to colorbar constructor