plots_builder module¶
Mixin for building plots out of subplots.
MetaPlotsBuilderMixin class¶
Metaclass for PlotsBuilderMixin.
Superclasses
builtins.type
Subclasses
subplots class property¶
Subplots supported by PlotsBuilderMixin.plots.
PlotsBuilderMixin class¶
Mixin that implements PlotsBuilderMixin.plots.
Required to be a subclass of Wrapping.
Superclasses
Inherited members
Subclasses
build_subplots_doc class method¶
Build subplots documentation.
override_subplots_doc class method¶
Call this method on each subclass that overrides PlotsBuilderMixin.subplots.
plots method¶
PlotsBuilderMixin.plots(
subplots=None,
tags=None,
column=None,
group_by=None,
per_column=None,
split_columns=None,
silence_warnings=None,
template_context=None,
settings=None,
filters=None,
subplot_settings=None,
show_titles=None,
show_legend=None,
show_column_label=None,
hide_id_labels=None,
group_id_labels=None,
make_subplots_kwargs=None,
fig=None,
**layout_kwargs
)
Plot various parts of this object.
Args
subplots:str,tuple,iterable,or dict-
Subplots to plot.
Each element can be either:
- Subplot name (see keys in PlotsBuilderMixin.subplots)
- Tuple of a subplot name and a settings dict as in PlotsBuilderMixin.subplots
- Tuple of a subplot name and a template of instance CustomTemplate
- Tuple of a subplot name and a list of settings dicts to be expanded into multiple subplots
The settings dict can contain the following keys:
title: Title of the subplot. Defaults to the name.plot_func(required): Plotting function for custom subplots. Must write the supplied figurefigin-place and can return anything (it won't be used).xaxis_kwargs: Layout keyword arguments for the x-axis. Defaults todict(title='Index').yaxis_kwargs: Layout keyword arguments for the y-axis. Defaults to empty dict.tags,check_{filter},inv_check_{filter},resolve_plot_func,pass_{arg},resolve_path_{arg},resolve_{arg}andtemplate_context: The same as in StatsBuilderMixin forcalc_func.- Any other keyword argument that overrides the settings or is passed directly to
plot_func.
If
resolve_plot_funcis True, the plotting function may "request" any of the following arguments by accepting them or ifpass_{arg}was found in the settings dict:- Each of AttrResolverMixin.self_aliases: original object (ungrouped, with no column selected)
group_by: won't be passed if it was used in resolving the first attribute ofplot_funcspecified as a path, usepass_group_by=Trueto pass anywaycolumnsubplot_nametrace_names: list with the subplot name, can't be used in templatesadd_trace_kwargs: dict with subplot row and column indexxrefyrefxaxisyaxisx_domainy_domainfigsilence_warnings- Any argument from
settings - Any attribute of this object if it meant to be resolved (see AttrResolverMixin.resolve_attr)
Note
Layout-related resolution arguments such as
add_trace_kwargsare unavailable before filtering and thus cannot be used in any templates but can still be overridden.Pass
subplots='all'to plot all supported subplots. tags:stroriterable- See
tagsin StatsBuilderMixin. column:str- See
columnin StatsBuilderMixin. group_by:any- See
group_byin StatsBuilderMixin. per_column:bool- See
per_columnin StatsBuilderMixin. split_columns:bool- See
split_columnsin StatsBuilderMixin. silence_warnings:bool- See
silence_warningsin StatsBuilderMixin. template_context:mapping-
See
template_contextin StatsBuilderMixin.Applied on
settings,make_subplots_kwargs, andlayout_kwargs, and then on each subplot settings. filters:dict- See
filtersin StatsBuilderMixin. settings:dict- See
settingsin StatsBuilderMixin. subplot_settings:dict- See
metric_settingsin StatsBuilderMixin. show_titles:bool- Whether to show the title of each subplot.
show_legend:bool-
Whether to show legend.
If None and plotting per column, becomes False, otherwise True.
show_column_label:bool-
Whether to show the column label next to each legend label.
If None and plotting per column, becomes True, otherwise False.
hide_id_labels:bool-
Whether to hide identical legend labels.
Two labels are identical if their name, marker style and line style match.
group_id_labels:bool- Whether to group identical legend labels.
make_subplots_kwargs:dict- Keyword arguments passed to
plotly.subplots.make_subplots. fig:FigureorFigureWidget- Figure to add traces to.
**layout_kwargs- Keyword arguments used to update the layout of the figure.
Note
PlotsBuilderMixin and StatsBuilderMixin are very similar. Some artifacts follow the same concept, just named differently:
plots_defaultsvsstats_defaultssubplotsvsmetricssubplot_settingsvsmetric_settings
See further notes under StatsBuilderMixin.
plots_defaults class property¶
Defaults for PlotsBuilderMixin.plots.
resolve_plots_setting method¶
Resolve a setting for PlotsBuilderMixin.plots.
subplots property¶
Subplots supported by PlotsBuilderMixin.
Returns PlotsBuilderMixin._subplots, which gets (hybrid-) copied upon creation of each instance. Thus, changing this config won't affect the class.
To change subplots, you can either change the config in-place, override this property, or overwrite the instance variable PlotsBuilderMixin._subplots.