holoviews.plotting.bokeh.element module#

class holoviews.plotting.bokeh.element.AnnotationPlot[source]#

Bases: object

Mix-in plotting subclass for AnnotationPlots which do not have a legend.

class holoviews.plotting.bokeh.element.ColorbarPlot(element, plot=None, **params)[source]#

Bases: ElementPlot

ColorbarPlot provides methods to create colormappers and colorbar models which can be added to a glyph. Additionally it provides parameters to control the position and other styling options of the colorbar. The default colorbar_position options are defined by the colorbar_specs, but may be overridden by the colorbar_opts.

Parameter Definitions


Parameters inherited from:

holoviews.plotting.plot.DimensionedPlot: fontscale, show_title, normalize, projection

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

holoviews.plotting.bokeh.plot.BokehPlot: title, shared_datasource, title_format

holoviews.plotting.bokeh.element.ElementPlot: fontsize, xticks, yticks, toolbar, width, height, active_tools, align, apply_hard_bounds, autorange, border, aspect, backend_opts, data_aspect, frame_width, frame_height, min_width, min_height, max_width, max_height, margin, multi_y, scalebar, scalebar_range, scalebar_unit, scalebar_location, scalebar_label, scalebar_tool, scalebar_opts, subcoordinate_y, subcoordinate_scale, responsive, gridstyle, labelled, lod, show_frame, shared_axes, default_tools, tools, hover_tooltips, hover_formatters, hover_mode, xformatter, yformatter

color_levels = ClassSelector(allow_None=True, class_=(<class 'int'>, <class 'list'>, <class 'range'>), label='Color levels')

Number of discrete colors to use when colormapping or a set of color intervals defining the range of values to map each color to.

cformatter = ClassSelector(allow_None=True, class_=(<class 'str'>, <class 'bokeh.models.formatters.TickFormatter'>, <class 'function'>), label='Cformatter')

Formatter for ticks along the colorbar axis.

clabel = String(allow_None=True, label='Clabel')

An explicit override of the color bar label. If set, takes precedence over the title key in colorbar_opts.

clim = Tuple(default=(nan, nan), label='Clim', length=2)

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

clim_percentile = ClassSelector(class_=(<class 'int'>, <class 'float'>, <class 'bool'>), default=False, label='Clim percentile')

Percentile value to compute colorscale robust to outliers. If True, uses 2nd and 98th percentile; otherwise uses the specified numerical percentile value.

cnorm = Selector(default='linear', label='Cnorm', names={}, objects=['linear', 'log', 'eq_hist'])

Color normalization to be applied during colormapping.

colorbar = Boolean(default=False, label='Colorbar')

Whether to display a colorbar.

colorbar_position = Selector(default='right', label='Colorbar position', names={}, objects=['right', 'left', 'bottom', 'top', 'top_right', 'top_left', 'bottom_left', 'bottom_right'])

Allows selecting between a number of predefined colorbar position options. The predefined options may be customized in the colorbar_specs class attribute.

colorbar_opts = Dict(class_=<class 'dict'>, default={}, label='Colorbar opts')

Allows setting specific styling options for the colorbar overriding the options defined in the colorbar_specs class attribute. Includes location, orientation, height, width, scale_alpha, title, title_props, margin, padding, background_fill_color and more.

clipping_colors = Dict(class_=<class 'dict'>, default={}, 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.

cticks = ClassSelector(allow_None=True, class_=(<class 'int'>, <class 'list'>, <class 'tuple'>, <class 'numpy.ndarray'>, <class 'bokeh.models.tickers.Ticker'>), label='Cticks')

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

logz = Boolean(default=False, label='Logz')

Whether to apply log scaling to the z-axis.

rescale_discrete_levels = Boolean(default=True, label='Rescale discrete levels')

If cnorm='eq_hist and there are only a few discrete values, then rescale_discrete_levels=True decreases the lower limit of the autoranged span so that the values are rendering towards the (more visible) top of the palette, thus avoiding washout of the lower values. Has no effect if cnorm!=`eq_hist.

symmetric = Boolean(default=False, label='Symmetric')

Whether to make the colormap symmetric around zero.

class holoviews.plotting.bokeh.element.CompositeElementPlot(element, plot=None, **params)[source]#

Bases: ElementPlot

A CompositeElementPlot is an Element plot type that coordinates drawing of multiple glyphs.

Parameter Definitions


Parameters inherited from:

holoviews.plotting.plot.DimensionedPlot: fontscale, show_title, normalize, projection

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

holoviews.plotting.bokeh.plot.BokehPlot: title, shared_datasource, title_format

holoviews.plotting.bokeh.element.ElementPlot: fontsize, xticks, yticks, toolbar, width, height, active_tools, align, apply_hard_bounds, autorange, border, aspect, backend_opts, data_aspect, frame_width, frame_height, min_width, min_height, max_width, max_height, margin, multi_y, scalebar, scalebar_range, scalebar_unit, scalebar_location, scalebar_label, scalebar_tool, scalebar_opts, subcoordinate_y, subcoordinate_scale, responsive, gridstyle, labelled, lod, show_frame, shared_axes, default_tools, tools, hover_tooltips, hover_formatters, hover_mode, xformatter, yformatter

class holoviews.plotting.bokeh.element.ElementPlot(element, plot=None, **params)[source]#

Bases: BokehPlot, GenericElementPlot

Parameter Definitions


Parameters inherited from:

holoviews.plotting.plot.DimensionedPlot: fontscale, show_title, normalize, projection

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

holoviews.plotting.bokeh.plot.BokehPlot: title, shared_datasource, title_format

fontsize = Parameter(allow_None=True, default={'title': '12pt'}, label='Fontsize')

Specifies various fontsizes of the displayed text. Finer control is available by supplying a dictionary where any unmentioned keys reverts to the default sizes, e.g: {‘ticks’: ‘20pt’, ‘title’: ‘15pt’, ‘ylabel’: ‘5px’, ‘xlabel’: ‘5px’}

xticks = ClassSelector(allow_None=True, class_=(<class 'int'>, <class 'list'>, <class 'tuple'>, <class 'numpy.ndarray'>, <class 'bokeh.models.tickers.Ticker'>), label='Xticks')

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

yticks = ClassSelector(allow_None=True, class_=(<class 'int'>, <class 'list'>, <class 'tuple'>, <class 'numpy.ndarray'>, <class 'bokeh.models.tickers.Ticker'>), label='Yticks')

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

toolbar = Selector(default='right', label='Toolbar', names={}, objects=['above', 'below', 'left', 'right', 'disable', None])

The toolbar location, must be one of ‘above’, ‘below’, ‘left’, ‘right’, None.

width = Integer(allow_None=True, bounds=(0, None), default=300, inclusive_bounds=(True, True), label='Width')

The width of the component (in pixels). This can be either fixed or preferred width, depending on width sizing policy.

height = Integer(allow_None=True, bounds=(0, None), default=300, inclusive_bounds=(True, True), label='Height')

The height of the component (in pixels). This can be either fixed or preferred height, depending on height sizing policy.

active_tools = List(allow_None=True, bounds=(0, None), label='Active tools')

Allows specifying which tools are active by default. Note that only one tool per gesture type can be active, e.g. both ‘pan’ and ‘box_zoom’ are drag tools, so if both are listed only the last one will be active. As a default ‘pan’ and ‘wheel_zoom’ will be used if the tools are enabled.

align = Selector(default='start', label='Align', names={}, objects=['start', 'center', 'end'])

Alignment (vertical or horizontal) of the plot in a layout.

apply_hard_bounds = Boolean(default=False, label='Apply hard bounds')

If True, the navigable bounds of the plot will be set based on the more extreme of extents between the data or xlim/ylim ranges. If dim ranges are set, the hard bounds will be set to the dim ranges.

autorange = Selector(label='Autorange', names={}, objects=['x', 'y', None])

Whether to auto-range along either the x- or y-axis, i.e. when panning or zooming along the orthogonal axis it will ensure all the data along the selected axis remains visible.

border = Number(default=10, inclusive_bounds=(True, True), label='Border')

Minimum border around plot.

aspect = Parameter(allow_None=True, label='Aspect')

The aspect ratio mode of the plot. By default, a plot may select its own appropriate aspect ratio but sometimes it may be necessary to force a square aspect ratio (e.g. to display the plot as an element of a grid). The modes ‘auto’ and ‘equal’ correspond to the axis modes of the same name in matplotlib, a numeric value specifying the ratio between plot width and height may also be passed. To control the aspect ratio between the axis scales use the data_aspect option instead.

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.

data_aspect = Number(allow_None=True, inclusive_bounds=(True, True), label='Data aspect')

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

frame_width = Integer(allow_None=True, bounds=(0, None), inclusive_bounds=(True, True), label='Frame width')

The width of the component (in pixels). This can be either fixed or preferred width, depending on width sizing policy.

frame_height = Integer(allow_None=True, bounds=(0, None), inclusive_bounds=(True, True), label='Frame height')

The height of the component (in pixels). This can be either fixed or preferred height, depending on height sizing policy.

min_width = Integer(allow_None=True, bounds=(0, None), inclusive_bounds=(True, True), label='Min width')

Minimal width of the component (in pixels) if width is adjustable.

min_height = Integer(allow_None=True, bounds=(0, None), inclusive_bounds=(True, True), label='Min height')

Minimal height of the component (in pixels) if height is adjustable.

max_width = Integer(allow_None=True, bounds=(0, None), inclusive_bounds=(True, True), label='Max width')

Minimal width of the component (in pixels) if width is adjustable.

max_height = Integer(allow_None=True, bounds=(0, None), inclusive_bounds=(True, True), label='Max height')

Minimal height of the component (in pixels) if height is adjustable.

margin = Parameter(allow_None=True, label='Margin')

Allows to create additional space around the component. May be specified as a two-tuple of the form (vertical, horizontal) or a four-tuple (top, right, bottom, left).

multi_y = Boolean(default=False, label='Multi y')

Enables multiple axes (one per value dimension) in overlays and useful for creating twin-axis plots. When enabled, axis options are no longer propagated between the elements and the overlay container, allowing customization on a per-axis basis.

scalebar = Boolean(default=False, label='Scalebar')

Whether to display a scalebar.

scalebar_range = Selector(default='x', label='Scalebar range', names={}, objects=['x', 'y'])

Whether to have the scalebar on the x or y axis.

scalebar_unit = ClassSelector(allow_None=True, class_=(<class 'str'>, <class 'tuple'>), label='Scalebar unit')

Unit of the scalebar. The order of how this will be done is by: 1. This value if it is set. 2. The elements kdim unit (if exist). 3. Meter If the value is a tuple, the first value will be the unit and the second will be the base unit. The scalebar_unit is only used if scalebar is True.

scalebar_location = Selector(label='Scalebar location', names={}, objects=['top_left', 'top_center', 'top_right', 'center_left', 'center_center', 'center_right', 'bottom_left', 'bottom_center', 'bottom_right', 'top', 'left', 'center', 'right', 'bottom'])

Location anchor for positioning scale bar. Default to ‘bottom_right’, except if subcoordinate_y is True then it will default to ‘right’. The scalebar_location is only used if scalebar is True.

scalebar_label = String(default='@{value} @{unit}', label='Scalebar label')

The label template. This can use special variables: * @{value} The current value. Optionally can provide a number formatter with e.g. @{value}{%.2f}. * @{unit} The unit of measure. The scalebar_label is only used if scalebar is True.

scalebar_tool = Boolean(default=True, label='Scalebar tool')

Whether to show scalebar tools in the toolbar, the tools are used to control scalebars visibility. The scalebar_tool is only used if scalebar is True.

scalebar_opts = Dict(class_=<class 'dict'>, default={}, label='Scalebar opts')

Allows setting specific styling options for the scalebar. See https://docs.bokeh.org/en/latest/docs/reference/models/annotations.html#bokeh.models.ScaleBar for more information. The scalebar_opts is only used if scalebar is True.

subcoordinate_y = ClassSelector(class_=(<class 'bool'>, <class 'tuple'>), default=False, label='Subcoordinate y')

Enables sub-coordinate systems for this plot. Accepts also a numerical two-tuple that must be a range between 0 and 1, the plot will be rendered on this vertical range of the axis.

subcoordinate_scale = Number(bounds=(0, None), default=1, inclusive_bounds=(False, True), label='Subcoordinate scale')

Scale factor for subcoordinate ranges to control the level of overlap.

responsive = Selector(default=False, label='Responsive', names={}, objects=[False, True, 'width', 'height'])

gridstyle = Dict(class_=<class 'dict'>, default={}, label='Gridstyle')

Allows customizing the grid style, e.g. grid_line_color defines the line color for both grids while xgrid_line_color exclusively customizes the x-axis grid lines.

labelled = List(bounds=(0, None), default=['x', 'y'], label='Labelled')

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

lod = Dict(class_=<class 'dict'>, default={'factor': 10, 'interval': 300, 'threshold': 2000, 'timeout': 500}, label='Lod')

Bokeh plots offer “Level of Detail” (LOD) capability to accommodate large (but not huge) amounts of data. The available options are: * factor : Decimation factor to use when applying decimation. * interval : Interval (in ms) downsampling will be enabled after an interactive event. * threshold : Number of samples before downsampling is enabled. * timeout : Timeout (in ms) for checking whether interactive tool events are still occurring.

show_frame = Boolean(default=True, label='Show frame')

Whether or not to show a complete frame around the plot.

shared_axes = Boolean(default=True, label='Shared axes')

Whether to invert the share axes across plots for linked panning and zooming.

default_tools = List(bounds=(0, None), default=['save', 'pan', 'wheel_zoom', 'box_zoom', 'reset'], label='Default tools')

A list of plugin tools to use on the plot.

tools = List(bounds=(0, None), default=[], label='Tools')

A list of plugin tools to use on the plot.

hover_tooltips = ClassSelector(allow_None=True, class_=(<class 'list'>, <class 'str'>), label='Hover tooltips')

A list of dimensions to be displayed in the hover tooltip.

hover_formatters = Dict(allow_None=True, class_=<class 'dict'>, label='Hover formatters')

A dict of formatting options for the hover tooltip.

hover_mode = Selector(default='mouse', label='Hover mode', names={}, objects=['mouse', 'vline', 'hline'])

The hover mode determines how the hover tool is activated.

xformatter = ClassSelector(allow_None=True, class_=(<class 'str'>, <class 'bokeh.models.formatters.TickFormatter'>, <class 'function'>), label='Xformatter')

Formatter for ticks along the x-axis.

yformatter = ClassSelector(allow_None=True, class_=(<class 'str'>, <class 'bokeh.models.formatters.TickFormatter'>, <class 'function'>), label='Yformatter')

Formatter for ticks along the x-axis.

property framewise#

Property to determine whether the current frame should have framewise normalization enabled. Required for bokeh plotting classes to determine whether to send updated ranges for each frame.

get_aspect(xspan, yspan)[source]#

Computes the aspect ratio of the plot

initialize_plot(ranges=None, plot=None, plots=None, source=None)[source]#

Initializes a new plot object with the last available frame.

model_changed(model)[source]#

Determines if the bokeh model was just changed on the frontend. Useful to suppress boomeranging events, e.g. when the frontend just sent an update to the x_range this should not trigger an update on the backend.

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.bokeh.element.LegendPlot(element, plot=None, **params)[source]#

Bases: ElementPlot

Parameter Definitions


Parameters inherited from:

holoviews.plotting.plot.DimensionedPlot: fontscale, show_title, normalize, projection

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

holoviews.plotting.bokeh.plot.BokehPlot: title, shared_datasource, title_format

holoviews.plotting.bokeh.element.ElementPlot: fontsize, xticks, yticks, toolbar, width, height, active_tools, align, apply_hard_bounds, autorange, border, aspect, backend_opts, data_aspect, frame_width, frame_height, min_width, min_height, max_width, max_height, margin, multi_y, scalebar, scalebar_range, scalebar_unit, scalebar_location, scalebar_label, scalebar_tool, scalebar_opts, subcoordinate_y, subcoordinate_scale, responsive, gridstyle, labelled, lod, show_frame, shared_axes, default_tools, tools, hover_tooltips, hover_formatters, hover_mode, xformatter, yformatter

legend_cols = Integer(bounds=(0, None), default=0, inclusive_bounds=(True, True), label='Legend cols')

Number of columns for legend.

legend_labels = Dict(allow_None=True, class_=<class 'dict'>, label='Legend labels')

Label overrides.

legend_muted = Boolean(default=False, label='Legend muted')

Controls whether the legend entries are muted by default.

legend_offset = NumericTuple(default=(0, 0), label='Legend offset', length=2)

If legend is placed outside the axis, this determines the (width, height) offset in pixels from the original position.

legend_position = Selector(default='top_right', label='Legend position', names={}, objects=['top_right', 'top_left', 'bottom_left', 'bottom_right', 'right', 'left', 'top', 'bottom'])

Allows selecting between a number of predefined legend position options. The predefined options may be customized in the legend_specs class attribute.

legend_opts = Dict(class_=<class 'dict'>, default={}, label='Legend opts')

Allows setting specific styling options for the colorbar.

class holoviews.plotting.bokeh.element.OverlayPlot(overlay, **kwargs)[source]#

Bases: GenericOverlayPlot, LegendPlot

Parameter Definitions


Parameters inherited from:

holoviews.plotting.plot.DimensionedPlot: fontscale, show_title, normalize, projection

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

holoviews.plotting.bokeh.plot.BokehPlot: title, shared_datasource, title_format

holoviews.plotting.bokeh.element.ElementPlot: fontsize, xticks, yticks, toolbar, width, height, active_tools, align, apply_hard_bounds, autorange, border, aspect, backend_opts, data_aspect, frame_width, frame_height, min_width, min_height, max_width, max_height, margin, multi_y, scalebar, scalebar_range, scalebar_unit, scalebar_location, scalebar_label, scalebar_tool, scalebar_opts, subcoordinate_y, subcoordinate_scale, responsive, gridstyle, labelled, lod, show_frame, shared_axes, default_tools, tools, hover_tooltips, hover_formatters, hover_mode, xformatter, yformatter

holoviews.plotting.bokeh.element.LegendPlot: legend_cols, legend_labels, legend_muted, legend_offset, legend_position, legend_opts

holoviews.plotting.plot.GenericOverlayPlot: show_legend, batched, legend_limit, style_grouping

tabs = Boolean(default=False, label='Tabs')

Whether to display overlaid plots in separate panes

multiple_legends = Boolean(default=False, label='Multiple legends')

Whether to split the legend for subplots into multiple legends.

initialize_plot(ranges=None, plot=None, plots=None)[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.