holoviews.plotting.mpl.plot module#
- class holoviews.plotting.mpl.plot.AdjoinedPlot(keys=None, dimensions=None, layout_dimensions=None, uniform=True, subplot=False, adjoined=None, layout_num=0, style=None, subplots=None, dynamic=False, **params)[source]#
Bases:
DimensionedPlot
Parameter Definitions
Parameters inherited from:
holoviews.plotting.plot.DimensionedPlot
: fontsize, fontscale, title, normalize, projectionshow_title = Boolean(default=False, label='Show title')
Titles should be disabled on all SidePlots to avoid clutter.
aspect = Parameter(default='auto', label='Aspect')
Aspect ratios on SideHistogramPlot should be determined by the AdjointLayoutPlot.
bgcolor = Parameter(default=(1, 1, 1, 0), label='Bgcolor')
Make plot background invisible.
border_size = Number(default=0.25, inclusive_bounds=(True, True), label='Border size')
The size of the border expressed as a fraction of the main plot.
subplot_size = Number(default=0.25, inclusive_bounds=(True, True), label='Subplot size')
The size subplots as expressed as a fraction of the main plot.
show_xlabel = Boolean(default=False, label='Show xlabel')
Whether to show the x-label of the plot. Disabled by default because plots are often too cramped to fit the title correctly.
- class holoviews.plotting.mpl.plot.AdjointLayoutPlot(layout, layout_type, subaxes, subplots, **params)[source]#
Bases:
MPLPlot
,GenericAdjointLayoutPlot
Initially, a AdjointLayoutPlot computes an appropriate layout based for the number of Views in the AdjointLayout object it has been given, but when embedded in a NdLayout, it can recompute the layout to match the number of rows and columns as part of a larger grid.
Parameter Definitions
Parameters inherited from:
holoviews.plotting.plot.DimensionedPlot
: fontsize, fontscale, show_title, title, normalizeholoviews.plotting.mpl.plot.MPLPlot
: projection, backend_opts, fig_alpha, fig_bounds, fig_inches, fig_latex, fig_rcparams, fig_size, initial_hooks, sublabel_format, sublabel_offset, sublabel_position, sublabel_size, sublabel_skip, show_frame- adjust_positions(redraw=True)[source]#
Make adjustments to the positions of subplots (if available) relative to the main plot axes as required.
This method is called by LayoutPlot after an initial pass used to position all the Layouts together. This method allows LayoutPlots to make final adjustments to the axis positions.
- class holoviews.plotting.mpl.plot.CompositePlot(layout, keys=None, dimensions=None, **params)[source]#
Bases:
GenericCompositePlot
,MPLPlot
CompositePlot provides a baseclass for plots coordinate multiple subplots to form a Layout.
Parameter Definitions
Parameters inherited from:
holoviews.plotting.plot.DimensionedPlot
: fontsize, fontscale, show_title, title, normalizeholoviews.plotting.mpl.plot.MPLPlot
: projection, backend_opts, fig_alpha, fig_bounds, fig_inches, fig_latex, fig_rcparams, fig_size, initial_hooks, sublabel_format, sublabel_offset, sublabel_position, sublabel_size, sublabel_skip, show_frameshared_axes = Boolean(default=True, label='Shared axes')
Whether axes ranges should be shared across the layout, if disabled switches axiswise normalization option on globally.
- class holoviews.plotting.mpl.plot.GridPlot(layout, axis=None, create_axes=True, ranges=None, layout_num=1, keys=None, **params)[source]#
Bases:
CompositePlot
Plot a group of elements in a grid layout based on a GridSpace element object.
Parameter Definitions
Parameters inherited from:
holoviews.plotting.plot.DimensionedPlot
: fontsize, fontscale, show_title, title, normalizeholoviews.plotting.mpl.plot.MPLPlot
: projection, backend_opts, fig_alpha, fig_bounds, fig_inches, fig_latex, fig_rcparams, fig_size, initial_hooks, sublabel_format, sublabel_offset, sublabel_position, sublabel_size, sublabel_skip, show_frameholoviews.plotting.mpl.plot.CompositePlot
: shared_axesaspect = Parameter(default='equal', label='Aspect')
Aspect ratios on GridPlot should be automatically determined.
padding = Number(default=0.1, inclusive_bounds=(True, True), label='Padding')
The amount of padding as a fraction of the total Grid size
shared_xaxis = Boolean(default=False, label='Shared xaxis')
If enabled the x-axes of the GridSpace will be drawn from the objects inside the Grid rather than the GridSpace dimensions.
shared_yaxis = Boolean(default=False, label='Shared yaxis')
If enabled the x-axes of the GridSpace will be drawn from the objects inside the Grid rather than the GridSpace dimensions.
show_legend = Boolean(default=False, label='Show legend')
Legends add to much clutter in a grid and are disabled by default.
xaxis = Selector(default='bottom', label='Xaxis', names={}, objects=['bottom', 'top', None])
Whether and where to display the xaxis, supported options are ‘bottom’, ‘top’ and None.
yaxis = Selector(default='left', label='Yaxis', names={}, objects=['left', 'right', None])
Whether and where to display the yaxis, supported options are ‘left’, ‘right’ and None.
xrotation = Integer(bounds=(0, 360), default=0, inclusive_bounds=(True, True), label='Xrotation')
Rotation angle of the xticks.
yrotation = Integer(bounds=(0, 360), default=0, inclusive_bounds=(True, True), label='Yrotation')
Rotation angle of the yticks.
- class holoviews.plotting.mpl.plot.LayoutPlot(layout, keys=None, **params)[source]#
Bases:
GenericLayoutPlot
,CompositePlot
A LayoutPlot accepts either a Layout or a NdLayout and displays the elements in a cartesian grid in scanline order.
Parameter Definitions
Parameters inherited from:
holoviews.plotting.plot.DimensionedPlot
: fontscale, show_title, title, normalizeholoviews.plotting.mpl.plot.MPLPlot
: projection, backend_opts, fig_alpha, fig_inches, fig_latex, fig_rcparams, fig_size, initial_hooks, sublabel_format, sublabel_offset, sublabel_position, sublabel_size, sublabel_skip, show_frameholoviews.plotting.mpl.plot.CompositePlot
: shared_axesholoviews.plotting.plot.GenericLayoutPlot
: transposefontsize = Parameter(allow_None=True, default={'title': 16}, label='Fontsize')
Specifies various font sizes of the displayed text. Finer control is available by supplying a dictionary where any unmentioned keys revert to the default sizes, e.g: {‘ticks’:20, ‘title’:15, ‘ylabel’:5, ‘xlabel’:5, ‘zlabel’:5, ‘legend’:8, ‘legend_title’:13} You can set the font size of ‘zlabel’, ‘ylabel’ and ‘xlabel’ together using the ‘labels’ key.
fig_bounds = NumericTuple(default=(0.05, 0.05, 0.95, 0.95), label='Fig bounds', length=4)
The bounds of the figure as a 4-tuple of the form (left, bottom, right, top), defining the size of the border around the subplots.
absolute_scaling = Selector(default=False, label='Absolute scaling', names={}, objects=[False])
If aspect_weight is enabled absolute_scaling determines whether axes are scaled relative to the widest plot or whether the aspect scales the axes in absolute terms.
aspect_weight = Number(default=0, inclusive_bounds=(True, True), label='Aspect weight')
Weighting of the individual aspects when computing the Layout grid aspects and overall figure size.
tight = Boolean(default=False, label='Tight')
Tightly fit the axes in the layout within the fig_bounds and tight_padding.
tight_padding = Parameter(default=3, label='Tight padding')
Integer or tuple specifying the padding in inches in a tight layout.
hspace = Number(default=0.5, inclusive_bounds=(True, True), label='Hspace')
Specifies the space between horizontally adjacent elements in the grid. Default value is set conservatively to avoid overlap of subplots.
vspace = Number(default=0.3, inclusive_bounds=(True, True), label='Vspace')
Specifies the space between vertically adjacent elements in the grid. Default value is set conservatively to avoid overlap of subplots.
- grid_situate(current_idx, layout_type, subgrid_width)[source]#
Situate the current AdjointLayoutPlot in a LayoutPlot. The LayoutPlot specifies a layout_type into which the AdjointLayoutPlot must be embedded. This enclosing layout is guaranteed to have enough cells to display all the views.
Based on this enforced layout format, a starting index supplied by LayoutPlot (indexing into a large gridspec arrangement) is updated to the appropriate embedded value. It will also return a list of gridspec indices associated with the all the required layout axes.
- class holoviews.plotting.mpl.plot.MPLPlot(fig=None, axis=None, **params)[source]#
Bases:
DimensionedPlot
An MPLPlot object draws a matplotlib figure object when called or indexed but can also return a matplotlib animation object as appropriate. MPLPlots take element objects such as Image, Contours or Points as inputs and plots them in the appropriate format using matplotlib. As HoloMaps are supported, all plots support animation via the anim() method.
Parameter Definitions
Parameters inherited from:
holoviews.plotting.plot.DimensionedPlot
: fontsize, fontscale, show_title, title, normalizeprojection = Parameter(allow_None=True, label='Projection')
The projection of the plot axis, default of None is equivalent to 2D plot, ‘3d’ and ‘polar’ are also supported by matplotlib by default. May also supply a custom projection that is either a matplotlib projection type or implements the _as_mpl_axes method.
backend_opts = Dict(class_=<class 'dict'>, default={}, label='Backend opts')
A dictionary of custom options to apply to the plot or subcomponents of the plot. The keys in the dictionary mirror attribute access on the underlying models stored in the plot’s handles, e.g. {‘colorbar.margin’: 10} will index the colorbar in the Plot.handles and then set the margin to 10.
fig_alpha = Number(bounds=(0, 1), default=1.0, inclusive_bounds=(True, True), label='Fig alpha')
Alpha of the overall figure background.
fig_bounds = NumericTuple(default=(0.15, 0.15, 0.85, 0.85), label='Fig bounds', length=4)
The bounds of the overall figure as a 4-tuple of the form (left, bottom, right, top), defining the size of the border around the subplots.
fig_inches = Parameter(default=4, label='Fig inches')
The overall matplotlib figure size in inches. May be set as an integer in which case it will be used to autocompute a size. Alternatively may be set with an explicit tuple or list, in which case it will be applied directly after being scaled by fig_size. If either the width or height is set to None, it will be computed automatically.
fig_latex = Boolean(default=False, label='Fig latex')
Whether to use LaTeX text in the overall figure.
fig_rcparams = Dict(class_=<class 'dict'>, default={}, label='Fig rcparams')
matplotlib rc parameters to apply to the overall figure.
fig_size = Number(bounds=(1, None), default=100.0, inclusive_bounds=(True, True), label='Fig size')
Size relative to the supplied overall fig_inches in percent.
initial_hooks = HookList(bounds=(0, None), default=[], label='Initial hooks')
Optional list of hooks called before plotting the data onto the axis (now marked for deprecation). The hook is passed the plot object and the displayed object; other plotting handles can be accessed via plot.handles.
sublabel_format = String(allow_None=True, label='Sublabel format')
Allows labeling the subaxes in each plot with various formatters including {Alpha}, {alpha}, {numeric} and {roman}.
sublabel_offset = Number(bounds=(0, None), default=0, inclusive_bounds=(True, True), label='Sublabel offset')
Allows offsetting the sublabel index.
sublabel_position = NumericTuple(default=(-0.35, 0.85), label='Sublabel position', length=2)
Position relative to the plot for placing the optional subfigure label.
sublabel_size = Number(default=18, inclusive_bounds=(True, True), label='Sublabel size')
Size of optional subfigure label.
sublabel_skip = List(allow_None=True, bounds=(0, None), class_=<class 'int'>, item_type=<class 'int'>, label='Sublabel skip')
List of elements to skip when labeling subplots. Numbering starts at 1.
show_frame = Boolean(default=False, label='Show frame')
Whether or not to show a complete frame around the plot.
- anim(start=0, stop=None, fps=30)[source]#
Method to return a matplotlib animation. The start and stop frames may be specified as well as the fps.
- property state#
The plotting state that gets updated via the update method and used by the renderer to generate output.