arviz_plots.PlotCollection#
- class arviz_plots.PlotCollection(data, viz_dt, aes_dt=None, aes=None, backend=None, **kwargs)[source]#
Low level base class for plotting with xarray Datasets.
This class instantiates a figure with multiple plots in it and provides methods to loop over these plots and the provided data syncing each plot and data subset to user given aesthetics.
- Attributes:
vizxarray.DataTreeInformation about the visual elements in the plot as a DataTree.
aesxarray.DataTreeInformation about aesthetic mapping as a DataTree.
See also
arviz_plots.PlotMatrixPairwise facetting manager
- __init__(data, viz_dt, aes_dt=None, aes=None, backend=None, **kwargs)[source]#
Initialize a PlotCollection.
It is not recommeded to initialize
PlotCollectionobjects directly. Use its classmethodswrapandgridinstead.- Parameters:
- data
xarray.Dataset The data from which viz_dt was generated and from which to generate the aesthetic mappings.
- viz_dt
xarray.DataTree DataTree object with which to populate the
vizattribute.- aes_dt
xarray.DataTree, optional DataTree object with which to populate the
aesattribute. If given, theaesargument and all **kwargs are ignored.- aesmapping of {
strlistof hashable}, optional Dictionary with aesthetics as keys and as values a list of the dimensions it should be mapped to. See
generate_aes_dtfor more details.- backend
str, optional Plotting backend. It will be stored and passed down to the plotting functions when using methods like
map.- **kwargsmapping, optional
Dictionary with aesthetics as keys and as values a list of the values that should be taken by that aesthetic.
- data
Methods
__init__(data, viz_dt[, aes_dt, aes, backend])Initialize a PlotCollection.
add_legend(dim[, aes, artist_kwargs, title, ...])Add a legend for the given visual/aesthetic to the plot.
allocate_artist(fun_label, data, all_loop_dims)Allocate an visual in the
vizDataTree.generate_aes_dt(aes[, data])Generate the aesthetic mappings.
get_aes_as_dataset(aes_key)Get the values of the provided aes_key for all variables as a Dataset.
get_aes_kwargs(aes, var_name, selection)Get the aesthetic mappings for the given variable and selection as a dictionary.
get_target(var_name, selection)Get the target that corresponds to the given variable and selection.
get_viz(artist_name[, var_name, sel])Get element from
.vizthat corresponds to the provided subset.grid(data[, cols, rows, backend, figure_kwargs])Instatiate a PlotCollection and generate a plot grid iterating over rows and columns.
map(fun[, fun_label, data, coords, ...])Apply the given plotting function to all plots with the corresponding aesthetics.
rename_visuals([name_dict])Rename visual data variables in the
vizDataTree.savefig(filename, **kwargs)Call the backend function to save this figure.
show()Call the backend function to show this figure.
store_in_artist_da(aux_artist, fun_label, ...)Store the visual object of var_name`+`sel combination in fun_label variable.
update_aes([ignore_aes, coords])Update list of aesthetics after indicating ignores and extra subsets.
update_aes_from_dataset(aes_key, dataset)Update the values of aes_key with those in the provided Dataset.
wrap(data[, cols, col_wrap, backend, ...])Instatiate a PlotCollection and generate a plot grid iterating over subsets and wrapping.
Attributes
Information about aesthetic mapping as a DataTree.
Return all aesthetics with a mapping defined as a set.
coordsInformation about slicing operation to always be applied on the PlotCollection.
Dataset to be used as data for plotting.
Dimensions over which one should loop for facetting when using this PlotCollection.
Information about the visual elements in the plot as a DataTree.