holoviews.plotting.mpl.raster module#

class holoviews.plotting.mpl.raster.QuadMeshPlot(*args, **kwargs)[source]#

Bases: ColorbarPlot

Parameter Definitions


Parameters inherited from:

holoviews.plotting.plot.DimensionedPlot: fontsize, fontscale, show_title, title, normalize

holoviews.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

holoviews.plotting.plot.GenericElementPlot: apply_ranges, apply_extents, bgcolor, default_span, hooks, invert_axes, invert_xaxis, invert_yaxis, logx, logy, show_grid, xaxis, yaxis, xlabel, ylabel, xlim, ylim, zlim, xrotation, yrotation, xticks, yticks

holoviews.plotting.mpl.element.ElementPlot: apply_ticks, aspect, data_aspect, invert_zaxis, labelled, logz, xformatter, yformatter, zformatter, zaxis, zlabel, zrotation, zticks

holoviews.plotting.mpl.element.ColorbarPlot: clabel, clim, clim_percentile, cformatter, colorbar, colorbar_opts, color_levels, cnorm, cbar_padding, cbar_ticks, cbar_width, cbar_extend, rescale_discrete_levels, symmetric

padding = ClassSelector(class_=(<class 'int'>, <class 'float'>, <class 'tuple'>), default=0, label='Padding')

Fraction by which to increase auto-ranged extents to make datapoints more visible around borders. To compute padding, the axis whose screen size is largest is chosen, and the range of that axis is increased by the specified fraction along each axis. Other axes are then padded ensuring that the amount of screen space devoted to padding is equal for all axes. If specified as a tuple, the int or float values in the tuple will be used for padding in each axis, in order (x,y or x,y,z). For example, for padding=0.2 on a 800x800-pixel plot, an x-axis with the range [0,10] will be padded by 20% to be [-1,11], while a y-axis with a range [0,1000] will be padded to be [-100,1100], which should make the padding be approximately the same number of pixels. But if the same plot is changed to have a height of only 200, the y-range will then be [-400,1400] so that the y-axis padding will still match that of the x-axis. It is also possible to declare non-equal padding value for the lower and upper bound of an axis by supplying nested tuples, e.g. padding=(0.1, (0, 0.1)) will pad the x-axis lower and upper bound as well as the y-axis upper bound by a fraction of 0.1 while the y-axis lower bound is not padded at all.

show_legend = Boolean(default=False, label='Show legend')

Whether to show legend for the plot.

clipping_colors = Dict(class_=<class 'dict'>, default={'NaN': 'transparent'}, label='Clipping colors')

Dictionary to specify colors for clipped values, allows setting color for NaN values and for values above and below the min and max value. The min, max or NaN color may specify an RGB(A) color as a color hex string of the form #FFFFFF or #FFFFFFFF or a length 3 or length 4 tuple specifying values in the range 0-1 or a named HTML color.

nodata = Integer(allow_None=True, inclusive_bounds=(True, True), label='Nodata')

Optional missing-data value for integer data. If non-None, data with this value will be replaced with NaN so that it is transparent (by default) when plotted.

init_artists(ax, plot_args, plot_kwargs)[source]#

Initializes the artist based on the plot method declared on the plot.

class holoviews.plotting.mpl.raster.RGBPlot(element, **params)[source]#

Bases: RasterBasePlot, LegendPlot

Parameter Definitions


Parameters inherited from:

holoviews.plotting.plot.DimensionedPlot: fontsize, fontscale, show_title, title, normalize

holoviews.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

holoviews.plotting.plot.GenericElementPlot: apply_ranges, apply_extents, bgcolor, default_span, hooks, invert_axes, invert_xaxis, invert_yaxis, logx, logy, show_grid, xaxis, yaxis, xlabel, ylabel, xlim, ylim, zlim, xrotation, yrotation, xticks, yticks

holoviews.plotting.mpl.element.ElementPlot: apply_ticks, data_aspect, invert_zaxis, labelled, logz, xformatter, yformatter, zformatter, zaxis, zlabel, zrotation, zticks

holoviews.plotting.mpl.element.LegendPlot: legend_cols, legend_labels, legend_position, legend_opts

holoviews.plotting.mpl.raster.RasterBasePlot: padding, show_legend, aspect, nodata, situate_axes

init_artists(ax, plot_args, plot_kwargs)[source]#

Initializes the artist based on the plot method declared on the plot.

update_handles(key, axis, element, ranges, style)[source]#

Update the elements of the plot.

class holoviews.plotting.mpl.raster.RasterBasePlot(element, **params)[source]#

Bases: ElementPlot

Parameter Definitions


Parameters inherited from:

holoviews.plotting.plot.DimensionedPlot: fontsize, fontscale, show_title, title, normalize

holoviews.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

holoviews.plotting.plot.GenericElementPlot: apply_ranges, apply_extents, bgcolor, default_span, hooks, invert_axes, invert_xaxis, invert_yaxis, logx, logy, show_grid, xaxis, yaxis, xlabel, ylabel, xlim, ylim, zlim, xrotation, yrotation, xticks, yticks

holoviews.plotting.mpl.element.ElementPlot: apply_ticks, data_aspect, invert_zaxis, labelled, logz, xformatter, yformatter, zformatter, zaxis, zlabel, zrotation, zticks

padding = ClassSelector(class_=(<class 'int'>, <class 'float'>, <class 'tuple'>), default=0, label='Padding')

Fraction by which to increase auto-ranged extents to make datapoints more visible around borders. To compute padding, the axis whose screen size is largest is chosen, and the range of that axis is increased by the specified fraction along each axis. Other axes are then padded ensuring that the amount of screen space devoted to padding is equal for all axes. If specified as a tuple, the int or float values in the tuple will be used for padding in each axis, in order (x,y or x,y,z). For example, for padding=0.2 on a 800x800-pixel plot, an x-axis with the range [0,10] will be padded by 20% to be [-1,11], while a y-axis with a range [0,1000] will be padded to be [-100,1100], which should make the padding be approximately the same number of pixels. But if the same plot is changed to have a height of only 200, the y-range will then be [-400,1400] so that the y-axis padding will still match that of the x-axis. It is also possible to declare non-equal padding value for the lower and upper bound of an axis by supplying nested tuples, e.g. padding=(0.1, (0, 0.1)) will pad the x-axis lower and upper bound as well as the y-axis upper bound by a fraction of 0.1 while the y-axis lower bound is not padded at all.

show_legend = Boolean(default=False, label='Show legend')

Whether to show legend for the plot.

aspect = Parameter(default='equal', label='Aspect')

Raster elements respect the aspect ratio of the Images by default but may be set to an explicit aspect ratio or to ‘square’.

nodata = Integer(allow_None=True, inclusive_bounds=(True, True), label='Nodata')

Optional missing-data value for integer data. If non-None, data with this value will be replaced with NaN so that it is transparent (by default) when plotted.

situate_axes = Boolean(default=True, label='Situate axes')

Whether to situate the image relative to other plots.

get_extents(element, ranges, range_type='combined', **kwargs)[source]#

Gets the extents for the axes from the current Element. The globally computed ranges can optionally override the extents.

The extents are computed by combining the data ranges, extents and dimension ranges. Each of these can be obtained individually by setting the range_type to one of:

  • ‘data’: Just the data ranges

  • ‘extents’: Element.extents

  • ‘soft’: Dimension.soft_range values

  • ‘hard’: Dimension.range values

To obtain the combined range, which includes range padding the default may be used:

  • ‘combined’: All the range types combined and padding applied

This allows Overlay plots to obtain each range and combine them appropriately for all the objects in the overlay.

If lims_as_soft_ranges is set to True, the xlim and ylim will be treated as soft ranges instead of the default case as hard ranges while computing the extents. This is used e.g. when apply_hard_bounds is True and xlim/ylim is set, in which case we limit the initial viewable range to xlim/ylim, but allow navigation up to the abs max between the data range and xlim/ylim.

class holoviews.plotting.mpl.raster.RasterGridPlot(layout, keys=None, dimensions=None, create_axes=False, ranges=None, layout_num=1, **params)[source]#

Bases: GridPlot, OverlayPlot

RasterGridPlot evenly spaces out plots of individual projections on a grid, even when they differ in size. Since this class uses a single axis to generate all the individual plots it is much faster than the equivalent using subplots.

Parameter Definitions


Parameters inherited from:

holoviews.plotting.plot.DimensionedPlot: fontsize, fontscale, show_title, title, normalize

holoviews.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

holoviews.plotting.mpl.plot.CompositePlot: shared_axes

holoviews.plotting.mpl.plot.GridPlot: aspect, shared_xaxis, shared_yaxis, show_legend, xaxis, yaxis, xrotation, yrotation

apply_ranges = Parameter(allow_None=True, default=True, label='Apply ranges')

Whether to compute the plot bounds from the data itself.

apply_extents = Parameter(allow_None=True, default=True, label='Apply extents')

Whether to apply extent overrides on the Elements

bgcolor = Parameter(allow_None=True, label='Bgcolor')

If set bgcolor overrides the background color of the axis.

default_span = Parameter(allow_None=True, default=2.0, label='Default span')

Defines the span of an axis if the axis range is zero, i.e. if the lower and upper end of an axis are equal or no range is defined at all. For example if there is a single datapoint at 0 a default_span of 2.0 will result in axis ranges spanning from -1 to 1.

hooks = Parameter(allow_None=True, default=[], label='Hooks')

Optional list of hooks called when finalizing a plot. The hook is passed the plot object and the displayed element, and other plotting handles can be accessed via plot.handles.

invert_axes = Parameter(allow_None=True, default=False, label='Invert axes')

Whether to invert the x- and y-axis

invert_xaxis = Parameter(allow_None=True, default=False, label='Invert xaxis')

Whether to invert the plot x-axis.

invert_yaxis = Parameter(allow_None=True, default=False, label='Invert yaxis')

Whether to invert the plot y-axis.

logx = Parameter(allow_None=True, default=False, label='Logx')

Whether the x-axis of the plot will be a log axis.

logy = Parameter(allow_None=True, default=False, label='Logy')

Whether the y-axis of the plot will be a log axis.

padding = Number(default=0.1, inclusive_bounds=(True, True), label='Padding')

The amount of padding as a fraction of the total Grid size

show_grid = Parameter(allow_None=True, default=False, label='Show grid')

Whether to show a Cartesian grid on the plot.

xlabel = Parameter(allow_None=True, label='Xlabel')

An explicit override of the x-axis label, if set takes precedence over the dimension label.

ylabel = Parameter(allow_None=True, label='Ylabel')

An explicit override of the y-axis label, if set takes precedence over the dimension label.

xlim = Parameter(allow_None=True, default=(nan, nan), label='Xlim')

User-specified x-axis range limits for the plot, as a tuple (low,high). If specified, takes precedence over data and dimension ranges.

ylim = Parameter(allow_None=True, default=(nan, nan), label='Ylim')

User-specified y-axis range limits for the plot, as a tuple (low,high). If specified, takes precedence over data and dimension ranges.

zlim = Parameter(allow_None=True, default=(nan, nan), label='Zlim')

User-specified z-axis range limits for the plot, as a tuple (low,high). If specified, takes precedence over data and dimension ranges.

xticks = Parameter(allow_None=True, label='Xticks')

Ticks along x-axis specified as an integer, explicit list of tick locations. If set to None default ticking behavior is applied.

yticks = Parameter(allow_None=True, label='Yticks')

Ticks along y-axis specified as an integer, explicit list of tick locations. If set to None default ticking behavior is applied.

batched = Parameter(allow_None=True, default=True, label='Batched')

Whether to plot Elements NdOverlay in a batched plotting call if possible. Disables legends and zorder may not be preserved.

legend_limit = Parameter(allow_None=True, default=25, label='Legend limit')

Number of rendered glyphs before legends are disabled.

style_grouping = Parameter(allow_None=True, default=2, label='Style grouping')

The length of the type.group.label spec that will be used to group Elements into style groups. A style_grouping value of 1 will group just by type, a value of 2 will group by type and group, and a value of 3 will group by the full specification.

apply_ticks = Parameter(allow_None=True, default=True, label='Apply ticks')

Whether to apply custom ticks.

data_aspect = Parameter(allow_None=True, label='Data aspect')

Defines the aspect of the axis scaling, i.e. the ratio of y-unit to x-unit.

invert_zaxis = Parameter(allow_None=True, default=False, label='Invert zaxis')

Whether to invert the plot z-axis.

labelled = Parameter(allow_None=True, default=['x', 'y'], label='Labelled')

Whether to plot the ‘x’ and ‘y’ labels.

logz = Parameter(allow_None=True, default=False, label='Logz')

Whether to apply log scaling to the y-axis of the Chart.

xformatter = Parameter(allow_None=True, label='Xformatter')

Formatter for ticks along the x-axis.

yformatter = Parameter(allow_None=True, label='Yformatter')

Formatter for ticks along the y-axis.

zformatter = Parameter(allow_None=True, label='Zformatter')

Formatter for ticks along the z-axis.

zaxis = Parameter(allow_None=True, default=True, label='Zaxis')

Whether to display the z-axis.

zlabel = Parameter(allow_None=True, label='Zlabel')

An explicit override of the z-axis label, if set takes precedence over the dimension label.

zrotation = Parameter(allow_None=True, default=0, label='Zrotation')

Rotation angle of the zticks.

zticks = Parameter(allow_None=True, label='Zticks')

Ticks along z-axis specified as an integer, explicit list of tick locations, list of tuples containing the locations and labels or a matplotlib tick locator object. If set to None default matplotlib ticking behavior is applied.

legend_cols = Parameter(allow_None=True, label='Legend cols')

Number of legend columns in the legend.

legend_labels = Parameter(allow_None=True, default={}, label='Legend labels')

A mapping that allows overriding legend labels.

legend_position = Parameter(allow_None=True, default='inner', label='Legend position')

Allows selecting between a number of predefined legend position options. The predefined options may be customized in the legend_specs class attribute. By default, ‘inner’, ‘right’, ‘bottom’, ‘top’, ‘left’, ‘best’, ‘top_right’, ‘top_left’, ‘bottom_right’ and ‘bottom_left’ are supported.

legend_opts = Parameter(allow_None=True, default={}, label='Legend opts')

Allows setting specific styling options for the colorbar.

get_extents(view, ranges, range_type='combined', **kwargs)[source]#

Gets the extents for the axes from the current Element. The globally computed ranges can optionally override the extents.

The extents are computed by combining the data ranges, extents and dimension ranges. Each of these can be obtained individually by setting the range_type to one of:

  • ‘data’: Just the data ranges

  • ‘extents’: Element.extents

  • ‘soft’: Dimension.soft_range values

  • ‘hard’: Dimension.range values

To obtain the combined range, which includes range padding the default may be used:

  • ‘combined’: All the range types combined and padding applied

This allows Overlay plots to obtain each range and combine them appropriately for all the objects in the overlay.

If lims_as_soft_ranges is set to True, the xlim and ylim will be treated as soft ranges instead of the default case as hard ranges while computing the extents. This is used e.g. when apply_hard_bounds is True and xlim/ylim is set, in which case we limit the initial viewable range to xlim/ylim, but allow navigation up to the abs max between the data range and xlim/ylim.

initialize_plot(*args, **kwargs)[source]#

Initialize the matplotlib figure.

update_frame(*args, **kwargs)[source]#

Set the plot(s) to the given frame number. Operates by manipulating the matplotlib objects held in the self._handles dictionary.

If n is greater than the number of available frames, update using the last available frame.

class holoviews.plotting.mpl.raster.RasterPlot(*args, **kwargs)[source]#

Bases: RasterBasePlot, ColorbarPlot

Parameter Definitions


Parameters inherited from:

holoviews.plotting.plot.DimensionedPlot: fontsize, fontscale, show_title, title, normalize

holoviews.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

holoviews.plotting.plot.GenericElementPlot: apply_ranges, apply_extents, bgcolor, default_span, hooks, invert_axes, invert_xaxis, invert_yaxis, logx, logy, show_grid, xaxis, yaxis, xlabel, ylabel, xlim, ylim, zlim, xrotation, yrotation, xticks, yticks

holoviews.plotting.mpl.element.ElementPlot: apply_ticks, data_aspect, invert_zaxis, labelled, logz, xformatter, yformatter, zformatter, zaxis, zlabel, zrotation, zticks

holoviews.plotting.mpl.element.ColorbarPlot: clabel, clim, clim_percentile, cformatter, colorbar, colorbar_opts, color_levels, cnorm, cbar_padding, cbar_ticks, cbar_width, cbar_extend, rescale_discrete_levels, symmetric

holoviews.plotting.mpl.raster.RasterBasePlot: padding, show_legend, aspect, nodata, situate_axes

clipping_colors = Dict(class_=<class 'dict'>, default={'NaN': 'transparent'}, label='Clipping colors')

Dictionary to specify colors for clipped values, allows setting color for NaN values and for values above and below the min and max value. The min, max or NaN color may specify an RGB(A) color as a color hex string of the form #FFFFFF or #FFFFFFFF or a length 3 or length 4 tuple specifying values in the range 0-1 or a named HTML color.

update_handles(key, axis, element, ranges, style)[source]#

Update the elements of the plot.