xyzpy.plot.infiniplot
#
Module Contents#
Classes#
Functions#
|
|
Decorator to use xyzpy neutral style for a function. |
|
|
|
|
Modify the luminosity of rgb color |
|
|
|
|
|
|
|
|
|
|
|
Helper class for the infiniplot functionality. |
Attributes#
- xyzpy.plot.infiniplot.use_neutral_style(fn)[source]#
Decorator to use xyzpy neutral style for a function.
- xyzpy.plot.infiniplot._COLORS_DEFAULT = ('#56B4E9', '#E69F00', '#009E73', '#D55E00', '#F0E442', '#CC79A7', '#0072B2')#
- xyzpy.plot.infiniplot._COLORS_SORTED = ('#0072B2', '#56B4E9', '#009E73', '#F0E442', '#E69F00', '#D55E00', '#CC79A7')#
- xyzpy.plot.infiniplot._LINESTYLES_DEFAULT = ('solid', (0.0, (3, 1)), (0.5, (1, 1)), (1.0, (3, 1, 1, 1)), (1.5, (3, 1, 3, 1, 1, 1)), (2.0,...#
- xyzpy.plot.infiniplot._MARKERS_DEFAULT = ('o', 'X', 'v', 's', 'P', 'D', '^', 'h', '*', 'p', '<', 'd', '8', '>', 'H')#
- xyzpy.plot.infiniplot.INFINIPLOTTER_DEFAULTS#
- xyzpy.plot.infiniplot._PLOTTER_OPTS#
- xyzpy.plot.infiniplot._HEATMAP_INVALID_KWARGS#
- xyzpy.plot.infiniplot.infiniplot(ds, x, y=None, z=None, **kwargs)[source]#
Helper class for the infiniplot functionality.
- Parameters:
ds (xarray.Dataset) – Dataset to plot.
x (str) – Name of the x coordinate.
y (str, optional) – Name of the y coordinate. If not specified, histogram mode is activated and the values of
x
are binned to produce a density or frequency to use as the y-variable.z (str, optional) – Name of the z coordinate. If specified this turns on the heatmap mode.
bins (int or array_like, optional) – If in histogram mode, specify either the number of bins to use or the bin edges. If not specified, a default number of bins is automatically chosen based on the number of data points.
bins_density (bool, optional) – If in histogram mode, whether to plot the density (True) or frequency (False) of the data. Default is True.
aggregate (str or Sequence[str], optional) – If specified, aggregate over the given dimension(s) using
aggregate_method
(by default ‘median’). If True aggregate over all unmapped dimensions. If in heatmap mode, this is automatically set to True, since only one plot can be shown per axis.aggregate_method (str, optional) – If
aggregate
is specified, the method to use for aggregation. Any option available as a method on a DataArray can be used, e.g. ‘mean’, ‘median’, ‘max’. Default is ‘median’.aggregate_err_range (float or str, optional) –
If
aggregate
is specified, the range of the error bars or bands to show. The options are:'std'
: show the standard deviation of the data'stderr'
: show the standard error of the mean- float: show the given quantile range, e.g. 0.5 for the interquartile
range
err (str, optional) – If specified, a data variable to use for error bars or bands. This overrides any derived from
aggregate
.err_style (str, optional) –
If specified, the style of error to show. The options are:
'bars'
: show error bars'band'
: show error bands
err_kws (dict, optional) – Additional keyword arguments to pass to the error plotting function.
xlink (str, optional) – If specified, the name of a dimension to use for linking the x-axis. Used when you are plotting a variable rather than coordinate as
x
, but want to link each sweep of values as a line.color (str, optional) – If specified, the name of a dimension to use for mapping the color or intensity of each line. If
hue
is also specified, this controls the intensity of the color. If not a dimension, this is used as a constant color for all lines.colors (sequence, optional) – An explicit sequence of colors to use for the color-mapped dimension.
color_order (sequence, optional) – An explicit order of values to use for the color-mapped dimension.
color_label (str, optional) – An alternate label to use for the color-mapped dimension.
color_ticklabels (dict or sequence, optional) – A mapping from values to tick labels to use for the color-mapped dimension.
colormap_start (float, optional) – If using a palette, the starting value of the colormap to use, e.g. 0.2 would skip the first 20% of the colormap.
colormap_stop (float, optional) – If using a palette, the stopping value of the colormap to use, e.g. 0.9 would skip the last 10% of the colormap.
hue (str, optional) – If specified, the name of a dimension to use for mapping the color or hue of each line. If
color
is also specified, this controls the hue of the color. If not a dimension, this is used as a constant hue for all lines.hues (sequence, optional) – An explicit sequence of hues to use for the hue-mapped dimension.
hue_order (sequence, optional) – An explicit order of values to use for the hue-mapped dimension.
hue_label (str, optional) – An alternate label to use for the hue-mapped dimension.
hue_ticklabels (dict or sequence, optional) – A mapping from values to tick labels to use for the hue-mapped dimension.
palette (str, sequence, or colormap, optional) – If specified, the name of a colormap, or an actual colormap, to use for mapping the color or hue of each line. If both
color
andhue
are specified, you can supply a sequence of palettes here, withhue
controlling which palette, andcolor
controlling the intensity within the palette.autohue_start (float, optional) – If not using a palette, the starting hue to use for automatically generating a sequence of hues.
autohue_sweep (float, optional) – If not using a palette, the sweep of hues to use for automatically generating a sequence of hues.
autohue_opts (dict, optional) – Additional keyword arguments to pass to the automatic hue generator - see {func}`xyzpy.color.cimple`.
marker (str, optional) – If specified, the name of a dimension to use for mapping the marker style of each line. If not a dimension, this is used as a constant marker style for all lines.
markers (sequence, optional) – An explicit sequence of markers to use for the marker-mapped dimension.
marker_order (sequence, optional) – An explicit order of values to use for the marker-mapped dimension.
marker_label (str, optional) – An alternate label to use for the marker-mapped dimension.
marker_ticklabels (dict or sequence, optional) – A mapping from values to tick labels to use for the marker-mapped dimension.
markersize (str, optional) – If specified, the name of a dimension to use for mapping the marker size of each line. If not a dimension, this is used as a constant marker size for all lines.
markersizes (sequence, optional) – An explicit sequence of marker sizes to use for the markersize-mapped dimension.
markersize_order (sequence, optional) – An explicit order of values to use for the markersize-mapped dimension.
markersize_label (str, optional) – An alternate label to use for the markersize-mapped dimension.
markersize_ticklabels (dict or sequence, optional) – A mapping from values to tick labels to use for the markersize-mapped dimension.
markeredgecolor (str, optional) – If specified, the name of a dimension to use for mapping the marker edge color of each line. If not a dimension, this is used as a constant marker edge color for all lines.
markeredgecolors (sequence, optional) – An explicit sequence of marker edge colors to use for the markeredgecolor-mapped dimension.
markeredgecolor_order (sequence, optional) – An explicit order of values to use for the markeredgecolor-mapped dimension.
markeredgecolor_label (str, optional) – An alternate label to use for the markeredgecolor-mapped dimension.
markeredgecolor_ticklabels (dict or sequence, optional) – A mapping from values to tick labels to use for the markeredgecolor-mapped dimension.
linewidth (str, optional) – If specified, the name of a dimension to use for mapping the line width of each line. If not a dimension, this is used as a constant line width for all lines.
linewidths (sequence, optional) – An explicit sequence of line widths to use for the linewidth-mapped dimension.
linewidth_order (sequence, optional) – An explicit order of values to use for the linewidth-mapped dimension.
linewidth_label (str, optional) – An alternate label to use for the linewidth-mapped dimension.
linewidth_ticklabels – A mapping from values to tick labels to use for the linewidth-mapped dimension.
linestyle (str, optional) – If specified, the name of a dimension to use for mapping the line style of each line. If not a dimension, this is used as a constant line style for all lines.
linestyles (sequence, optional) – An explicit sequence of line styles to use for the linestyle-mapped dimension.
linestyle_order (sequence, optional) – An explicit order of values to use for the linestyle-mapped dimension.
linestyle_label (str, optional) – An alternate label to use for the linestyle-mapped dimension.
linestyle_ticklabels (dict or sequence, optional) – A mapping from values to tick labels to use for the linestyle-mapped dimension.
text (str, optional) – If specified, the name of a dimension to use for mapping text annotations to each line.
text_formatter (callable, optional) – A function to use to format data entries to text annotations. Default is
str
.text_opts (dict, optional) – Additional keyword arguments to pass to the text plotting function.
col (str, optional) – If specified, the name of a dimension to use for mapping the subplot column of each line.
col_order (sequence, optional) – An explicit order of values to use for the col-mapped dimension.
col_label (str, optional) – An alternate label to use for the col-mapped dimension.
col_ticklabels (dict or sequence, optional) – A mapping from values to tick labels to use for the col-mapped dimension.
row (str, optional) – If specified, the name of a dimension to use for mapping the subplot row of each line.
row_order (sequence, optional) – An explicit order of values to use for the row-mapped dimension.
row_label (str, optional) – An alternate label to use for the row-mapped dimension.
row_ticklabels (dict or sequence, optional) – A mapping from values to tick labels to use for the row-mapped dimension.
alpha (float, optional) – Global alpha value to use for all lines.
join_across_missing (bool, optional) – If True, join lines across missing (NaN) data. Default is False.
err_band_alpha (float, optional) – Alpha value to use for error bands.
err_bar_capsize (float, optional) – Size of the caps on error bars.
xlabel (str, optional) – Alternate label to use for the x-axis.
ylabel (str, optional) – Alternate label to use for the y-axis.
xlim (tuple, optional) – Limits to use for the x-axis.
ylim (tuple, optional) – Limits to use for the y-axis.
xscale (str, optional) – Scale to use for the x-axis, e.g. ‘log’.
yscale (str, optional) – Scale to use for the y-axis, e.g. ‘log’.
zscale (str, optional) – Scale to use for a heatmap color dimension, e.g. ‘log’.
xbase (float, optional) – If
xscale=='log'
, the log base to use for the x-axis.ybase (float, optional) – If
yscale=='log'
, the log base to use for the y-axis.vspans (sequence[float], optional) – Sequence of x-values to use for vertical spans.
hspans (sequence[float], optional) – Sequence of y-values to use for horizontal spans.
span_color (str or tuple, optional) – Color to use for spans.
span_alpha (float, optional) – Alpha value to use for spans.
span_linewidth (float, optional) – Line width to use for spans.
span_linestyle (str, optional) – Line style to use for spans.
grid (bool, optional) – Whether to show grid lines.
grid_which (str, optional) – Which grid lines to show, either ‘major’ or ‘minor’.
grid_alpha (float, optional) – Alpha value to use for grid lines.
legend (bool, optional) – Whether to show a legend.
legend_ncol (int, optional) – Number of columns to use for the legend.
legend_merge (bool, optional) – If
True
, combinations of different mapped properties are merged into list of every combination.legend_reverse (bool, optional) – If
True
, reverse the order of the legend entries.legend_entries (sequence, optional) – An explicit sequence of legend entries to use.
legend_labels (sequence, optional) – An explicit sequence of legend labels to use.
legend_extras (sequence, optional) – An explicit sequence of extra legend items to add.
legend_opts (dict, optional) – Additional keyword arguments to pass to the legend plotting function.
title (str, optional) – A title to use for the plot.
axs (sequence[sequence[matplotlib.Axes]], optional) – An explicit array of axes to use for the plot, it should have at least as many rows and columns as there are mapped dimensions.
ax (matplotlib.Axes, optional) – Shortcut for supplying a single axes to use for the plot, can only supply if there is a single row and column.
format_axs (bool, optional) – Whether to format the axes to use the neutral xyzpy style.
figsize (tuple, optional) – Size of the figure to use if creating one (ax is axs is None). If not specified it is automatically computed based on the number of rows and columns.
height (float, optional) – Height of each subplot. Default is 3.
width (float, optional) – Width of each subplot. If not specified, it is automatically set to match
height
. Default is None.hspace (float, optional) – Spacing between subplots vertically. Default is 0.12.
wspace (float, optional) – Spacing between subplots horizontally. Default is 0.12.
sharex (bool, optional) – Whether to share the x-axis between subplots. Default is True.
sharey (bool, optional) – Whether to share the y-axis between subplots. Default is True.
kwargs (dict, optional) – Additional keyword arguments to pass to the main plotting function.
- Returns:
fig (matplotlib.Figure) – Figure containing the plot (None if
ax
oraxs
is specified).axs (sequence[sequence[matplotlib.Axes]]) – Array of axes containing the plot.