holoviews.plotting Package#


plotting Package#

HoloViews plotting sub-system the defines the interface to be used by any third-party plotting/rendering package.

This file defines the HTML tags used to wrap rendered output for display in the IPython Notebook (optional).

class holoviews.plotting.Cycle(cycle=None, **params)[source]#

Bases: Parameterized

A simple container class that specifies cyclic options. A typical example would be to cycle the curve colors in an Overlay composed of an arbitrary number of curves. The values may be supplied as an explicit list or a key to look up in the default cycles attribute.

key = param.String(allow_None=True, allow_refs=False, default=’default_colors’, label=’Key’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16ab04650>)

The key in the default_cycles dictionary used to specify the color cycle if values is not supplied.

values = param.List(allow_refs=False, bounds=(0, None), default=[], label=’Values’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16af84e50>)

The values the cycle will iterate over.

class holoviews.plotting.Plot(renderer=None, root=None, **params)[source]#

Bases: Parameterized

Base class of all Plot classes in HoloViews, designed to be general enough to use any plotting package or backend.

cleanup()[source]#

Cleans up references to the plot on the attached Stream subscribers.

initialize_plot(ranges=None)[source]#

Initialize the matplotlib figure.

push()[source]#

Pushes plot updates to the frontend.

refresh(**kwargs)[source]#

Refreshes the plot by rerendering it and then pushing the updated data if the plot has an associated Comm.

set_root(root)[source]#

Sets the root model on all subplots.

property state#

The plotting state that gets updated via the update method and used by the renderer to generate output.

update(key)[source]#

Update the internal state of the Plot to represent the given key tuple (where integers represent frames). Returns this state.

class holoviews.plotting.Renderer(*, backend, center, css, dpi, fig, fps, holomap, mode, post_render_hooks, size, widget_location, widget_mode, info_fn, key_fn, name)[source]#

Bases: Exporter

The job of a Renderer is to turn the plotting state held within Plot classes into concrete, visual output in the form of the PNG, SVG, MP4 or WebM formats (among others). Note that a Renderer is a type of Exporter and must therefore follow the Exporter interface.

The Renderer needs to be able to use the .state property of the appropriate Plot classes associated with that renderer in order to generate output. The process of ‘drawing’ is execute by the Plots and the Renderer turns the final plotting state into output.

key_fn = param.Callable(allow_None=True, allow_refs=False, constant=True, label=’Key fn’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b02fe50>)

Renderers do not support the saving of object key metadata

info_fn = param.Callable(allow_None=True, allow_refs=False, constant=True, label=’Info fn’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16973ac90>)

Renderers do not support the saving of object info metadata

center = param.Boolean(allow_refs=False, default=True, label=’Center’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b432c50>)

Whether to center the plot

backend = param.String(allow_refs=False, default=’’, label=’Backend’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16a045210>)

The full, lowercase name of the rendering backend or third part plotting package used e.g. ‘matplotlib’ or ‘cairo’.

dpi = param.Integer(allow_None=True, allow_refs=False, inclusive_bounds=(True, True), label=’Dpi’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x169738c10>)

The render resolution in dpi (dots per inch)

fig = param.Selector(allow_refs=False, default=’auto’, label=’Fig’, names={}, nested_refs=False, objects=[‘auto’], rx=<param.reactive.reactive_ops object at 0x16a869c90>)

Output render format for static figures. If None, no figure rendering will occur.

fps = param.Number(allow_refs=False, default=20, inclusive_bounds=(True, True), label=’Fps’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16ae326d0>)

Rendered fps (frames per second) for animated formats.

holomap = param.Selector(allow_refs=False, default=’auto’, label=’Holomap’, names={}, nested_refs=False, objects=[‘scrubber’, ‘widgets’, None, ‘auto’], rx=<param.reactive.reactive_ops object at 0x16b4306d0>)

Output render multi-frame (typically animated) format. If None, no multi-frame rendering will occur.

mode = param.Selector(allow_refs=False, default=’default’, label=’Mode’, names={}, nested_refs=False, objects=[‘default’, ‘server’], rx=<param.reactive.reactive_ops object at 0x16b4c6090>)

Whether to render the object in regular or server mode. In server mode a bokeh Document will be returned which can be served as a bokeh server app. By default renders all output is rendered to HTML.

size = param.Integer(allow_refs=False, default=100, inclusive_bounds=(True, True), label=’Size’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16a868a90>)

The rendered size as a percentage size

widget_location = param.Selector(allow_None=True, allow_refs=False, label=’Widget location’, names={}, nested_refs=False, objects=[‘left’, ‘bottom’, ‘right’, ‘top’, ‘top_left’, ‘top_right’, ‘bottom_left’, ‘bottom_right’, ‘left_top’, ‘left_bottom’, ‘right_top’, ‘right_bottom’], rx=<param.reactive.reactive_ops object at 0x1656e6e10>)

The position of the widgets relative to the plot.

widget_mode = param.Selector(allow_refs=False, default=’embed’, label=’Widget mode’, names={}, nested_refs=False, objects=[‘embed’, ‘live’], rx=<param.reactive.reactive_ops object at 0x16ae31710>)

The widget mode determining whether frames are embedded or generated ‘live’ when interacting with the widget.

css = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={}, label=’Css’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16ae5db10>)

Dictionary of CSS attributes and values to apply to HTML output.

post_render_hooks = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={‘svg’: [], ‘png’: []}, label=’Post render hooks’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16aba00d0>)

Optional dictionary of hooks that are applied to the rendered data (according to the output format) before it is returned. Each hook is passed the rendered data and the object that is being rendered. These hooks allow post-processing of rendered data before output is saved to file or displayed.

app(plot, show=False, new_window=False, websocket_origin=None, port=0)[source]#

Creates a bokeh app from a HoloViews object or plot. By default simply attaches the plot to bokeh’s curdoc and returns the Document, if show option is supplied creates an Application instance and displays it either in a browser window or inline if notebook extension has been loaded. Using the new_window option the app may be displayed in a new browser tab once the notebook extension has been loaded. A websocket origin is required when launching from an existing tornado server (such as the notebook) and it is not on the default port (‘localhost:8888’).

comm_manager[source]#

alias of CommManager

components(obj, fmt=None, comm=True, **kwargs)[source]#

Returns data and metadata dictionaries containing HTML and JS components to include render in app, notebook, or standalone document.

classmethod encode(entry)[source]#

Classmethod that applies conditional encoding based on mime-type. Given an entry as returned by __call__ return the data in the appropriate encoding.

export_widgets(obj, filename, fmt=None, template=None, json=False, json_path='', **kwargs)[source]#

Render and export object as a widget to a static HTML file. Allows supplying a custom template formatting string with fields to interpolate ‘js’, ‘css’ and the main ‘html’ containing the widget. Also provides options to export widget data to a json file in the supplied json_path (defaults to current path).

get_plot(obj, doc=None, renderer=None, comm=None, **kwargs)[source]#

Given a HoloViews Viewable return a corresponding plot instance.

get_plot_state(obj, renderer=None, **kwargs)[source]#

Given a HoloViews Viewable return a corresponding plot state.

get_size(plot)[source]#

Return the display size associated with a plot before rendering to any particular format. Used to generate appropriate HTML display.

Returns a tuple of (width, height) in pixels.

html(obj, fmt=None, css=None, resources='CDN', **kwargs)[source]#

Renders plot or data structure and wraps the output in HTML. The comm argument defines whether the HTML output includes code to initialize a Comm, if the plot supplies one.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

classmethod load_nb(inline=False, reloading=False, enable_mathjax=False)[source]#

Loads any resources required for display of plots in the Jupyter notebook

classmethod plot_options(obj, percent_size)[source]#

Given an object and a percentage size (as supplied by the %output magic) return all the appropriate plot options that would be used to instantiate a plot class for that element.

Default plot sizes at the plotting class level should be taken into account.

classmethod plotting_class(obj)[source]#

Given an object or Element class, return the suitable plotting class needed to render it with the current renderer.

save(obj, basename, fmt='auto', key=None, info=None, options=None, resources='inline', title=None, **kwargs)[source]#

Save a HoloViews object to file, either using an explicitly supplied format or to the appropriate default.

server_doc(obj, doc=None)[source]#

Get a bokeh Document with the plot attached. May supply an existing doc, otherwise bokeh.io.curdoc() is used to attach the plot to the global document instance.

classmethod state()[source]#

Context manager to handle global state for a backend, allowing Plot classes to temporarily override that state.

static_html(obj, fmt=None, template=None)[source]#

Generates a static HTML with the rendered object in the supplied format. Allows supplying a template formatting string with fields to interpolate ‘js’, ‘css’ and the main ‘html’.

classmethod validate(options)[source]#

Validate an options dictionary for the renderer.



mixins Module#


plot Module#

Public API for all plots supported by HoloViews, regardless of plotting package or backend. Every plotting classes must be a subclass of this Plot baseclass.

class holoviews.plotting.plot.DimensionedPlot(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: Plot

DimensionedPlot implements a number of useful methods to compute dimension ranges and titles containing the dimension values.

fontsize = param.Parameter(allow_None=True, allow_refs=False, label=’Fontsize’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b3070d0>)

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.

fontscale = param.Number(allow_None=True, allow_refs=False, inclusive_bounds=(True, True), label=’Fontscale’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b337010>)

Scales the size of all fonts.

show_title = param.Boolean(allow_refs=False, default=True, label=’Show title’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b57c910>)

Whether to display the plot title.

title = param.String(allow_refs=False, default=’{label} {group}n{dimensions}’, label=’Title’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b335910>)

The formatting string for the title of this plot, allows defining a label group separator and dimension labels.

normalize = param.Boolean(allow_refs=False, default=True, label=’Normalize’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b57c510>)

Whether to compute ranges across all Elements at this level of plotting. Allows selecting normalization at different levels for nested data containers.

projection = param.Parameter(allow_None=True, allow_refs=False, label=’Projection’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b337b90>)

Allows supplying a custom projection to transform the axis coordinates during display. Example projections include ‘3d’ and ‘polar’ projections supported by some backends. Depending on the backend custom, projection objects may be supplied.

cleanup()[source]#

Cleans up references to the plot on the attached Stream subscribers.

compute_ranges(obj, key, ranges)[source]#

Given an object, a specific key, and the normalization options, this method will find the specified normalization options on the appropriate OptionTree, group the elements according to the selected normalization option (i.e. either per frame or over the whole animation) and finally compute the dimension ranges in each group. The new set of ranges is returned.

initialize_plot(ranges=None)[source]#

Initialize the matplotlib figure.

matches(spec)[source]#

Matches a specification against the current Plot.

push()[source]#

Pushes plot updates to the frontend.

refresh(**kwargs)[source]#

Refreshes the plot by rerendering it and then pushing the updated data if the plot has an associated Comm.

set_root(root)[source]#

Sets the root model on all subplots.

property state#

The plotting state that gets updated via the update method and used by the renderer to generate output.

traverse(fn=None, specs=None, full_breadth=True)[source]#

Traverses any nested DimensionedPlot returning a list of all plots that match the specs. The specs should be supplied as a list of either Plot types or callables, which should return a boolean given the plot class.

update(key)[source]#

Update the internal state of the Plot to represent the given key tuple (where integers represent frames). Returns this state.

class holoviews.plotting.plot.GenericAdjointLayoutPlot(renderer=None, root=None, **params)[source]#

Bases: Plot

AdjointLayoutPlot allows placing up to three Views in a number of predefined and fixed layouts, which are defined by the layout_dict class attribute. This allows placing subviews next to a main plot in either a ‘top’ or ‘right’ position.

cleanup()[source]#

Cleans up references to the plot on the attached Stream subscribers.

initialize_plot(ranges=None)[source]#

Initialize the matplotlib figure.

push()[source]#

Pushes plot updates to the frontend.

refresh(**kwargs)[source]#

Refreshes the plot by rerendering it and then pushing the updated data if the plot has an associated Comm.

set_root(root)[source]#

Sets the root model on all subplots.

property state#

The plotting state that gets updated via the update method and used by the renderer to generate output.

update(key)[source]#

Update the internal state of the Plot to represent the given key tuple (where integers represent frames). Returns this state.

class holoviews.plotting.plot.GenericCompositePlot(layout, keys=None, dimensions=None, **params)[source]#

Bases: DimensionedPlot

Parameters inherited from:

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

cleanup()[source]#

Cleans up references to the plot on the attached Stream subscribers.

compute_ranges(obj, key, ranges)[source]#

Given an object, a specific key, and the normalization options, this method will find the specified normalization options on the appropriate OptionTree, group the elements according to the selected normalization option (i.e. either per frame or over the whole animation) and finally compute the dimension ranges in each group. The new set of ranges is returned.

initialize_plot(ranges=None)[source]#

Initialize the matplotlib figure.

matches(spec)[source]#

Matches a specification against the current Plot.

push()[source]#

Pushes plot updates to the frontend.

refresh(**kwargs)[source]#

Refreshes the plot by rerendering it and then pushing the updated data if the plot has an associated Comm.

set_root(root)[source]#

Sets the root model on all subplots.

property state#

The plotting state that gets updated via the update method and used by the renderer to generate output.

traverse(fn=None, specs=None, full_breadth=True)[source]#

Traverses any nested DimensionedPlot returning a list of all plots that match the specs. The specs should be supplied as a list of either Plot types or callables, which should return a boolean given the plot class.

update(key)[source]#

Update the internal state of the Plot to represent the given key tuple (where integers represent frames). Returns this state.

class holoviews.plotting.plot.GenericElementPlot(element, keys=None, ranges=None, dimensions=None, batched=False, overlaid=0, cyclic_index=0, zorder=0, style=None, overlay_dims=None, stream_sources=None, streams=None, **params)[source]#

Bases: DimensionedPlot

Plotting baseclass to render contents of an Element. Implements methods to get the correct frame given a HoloMap, axis labels and extents and titles.

Parameters inherited from:

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

apply_ranges = param.Boolean(allow_refs=False, default=True, label=’Apply ranges’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b529e90>)

Whether to compute the plot bounds from the data itself.

apply_extents = param.Boolean(allow_refs=False, default=True, label=’Apply extents’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5cd990>)

Whether to apply extent overrides on the Elements

bgcolor = param.ClassSelector(allow_None=True, allow_refs=False, class_=(<class ‘str’>, <class ‘tuple’>), label=’Bgcolor’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b529d50>)

If set bgcolor overrides the background color of the axis.

default_span = param.ClassSelector(allow_refs=False, class_=(<class ‘int’>, <class ‘float’>, <class ‘tuple’>), default=2.0, label=’Default span’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5ce0d0>)

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 = param.HookList(allow_refs=False, bounds=(0, None), default=[], label=’Hooks’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16ae1d650>)

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 = param.Boolean(allow_refs=False, default=False, label=’Invert axes’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b529450>)

Whether to invert the x- and y-axis

invert_xaxis = param.Boolean(allow_refs=False, default=False, label=’Invert xaxis’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5b9b90>)

Whether to invert the plot x-axis.

invert_yaxis = param.Boolean(allow_refs=False, default=False, label=’Invert yaxis’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b52b6d0>)

Whether to invert the plot y-axis.

logx = param.Boolean(allow_refs=False, default=False, label=’Logx’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5b8e10>)

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

logy = param.Boolean(allow_refs=False, default=False, label=’Logy’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5b9b90>)

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

padding = param.ClassSelector(allow_refs=False, class_=(<class ‘int’>, <class ‘float’>, <class ‘tuple’>), default=0.1, label=’Padding’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5baf50>)

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 = param.Boolean(allow_refs=False, default=True, label=’Show legend’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5b9b90>)

Whether to show legend for the plot.

show_grid = param.Boolean(allow_refs=False, default=False, label=’Show grid’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5b8e10>)

Whether to show a Cartesian grid on the plot.

xaxis = param.Selector(allow_refs=False, default=’bottom’, label=’Xaxis’, names={}, nested_refs=False, objects=[‘top’, ‘bottom’, ‘bare’, ‘top-bare’, ‘bottom-bare’, None, True, False], rx=<param.reactive.reactive_ops object at 0x16b528290>)

Whether and where to display the xaxis. The “bare” options allow suppressing all axis labels, including ticks and xlabel. Valid options are ‘top’, ‘bottom’, ‘bare’, ‘top-bare’ and ‘bottom-bare’.

yaxis = param.Selector(allow_refs=False, default=’left’, label=’Yaxis’, names={}, nested_refs=False, objects=[‘left’, ‘right’, ‘bare’, ‘left-bare’, ‘right-bare’, None, True, False], rx=<param.reactive.reactive_ops object at 0x16b52a710>)

Whether and where to display the yaxis. The “bare” options allow suppressing all axis labels, including ticks and ylabel. Valid options are ‘left’, ‘right’, ‘bare’, ‘left-bare’ and ‘right-bare’.

xlabel = param.String(allow_None=True, allow_refs=False, label=’Xlabel’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5badd0>)

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

ylabel = param.String(allow_None=True, allow_refs=False, label=’Ylabel’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5baf50>)

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

xlim = param.Tuple(allow_refs=False, default=(nan, nan), label=’Xlim’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5b8110>)

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

ylim = param.Tuple(allow_refs=False, default=(nan, nan), label=’Ylim’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5baf50>)

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

zlim = param.Tuple(allow_refs=False, default=(nan, nan), label=’Zlim’, length=2, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5b8110>)

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

xrotation = param.Integer(allow_None=True, allow_refs=False, bounds=(0, 360), inclusive_bounds=(True, True), label=’Xrotation’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b529b90>)

Rotation angle of the xticks.

yrotation = param.Integer(allow_None=True, allow_refs=False, bounds=(0, 360), inclusive_bounds=(True, True), label=’Yrotation’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b434750>)

Rotation angle of the yticks.

xticks = param.ClassSelector(allow_None=True, allow_refs=False, class_=(<class ‘int’>, <class ‘list’>, <class ‘tuple’>, <class ‘numpy.ndarray’>), label=’Xticks’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b5ba7d0>)

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

yticks = param.ClassSelector(allow_None=True, allow_refs=False, class_=(<class ‘int’>, <class ‘list’>, <class ‘tuple’>, <class ‘numpy.ndarray’>), label=’Yticks’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b260bd0>)

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

cleanup()[source]#

Cleans up references to the plot on the attached Stream subscribers.

compute_ranges(obj, key, ranges)[source]#

Given an object, a specific key, and the normalization options, this method will find the specified normalization options on the appropriate OptionTree, group the elements according to the selected normalization option (i.e. either per frame or over the whole animation) and finally compute the dimension ranges in each group. The new set of ranges is returned.

get_aspect(xspan, yspan)[source]#

Should define the aspect ratio of the plot.

get_extents(element, ranges, range_type='combined', dimension=None, xdim=None, ydim=None, zdim=None, lims_as_soft_ranges=False, **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.

get_padding(obj, extents)[source]#

Computes padding along the axes taking into account the plot aspect.

get_zorder(overlay, key, el)[source]#

Computes the z-order of element in the NdOverlay taking into account possible batching of elements.

initialize_plot(ranges=None)[source]#

Initialize the matplotlib figure.

matches(spec)[source]#

Matches a specification against the current Plot.

push()[source]#

Pushes plot updates to the frontend.

refresh(**kwargs)[source]#

Refreshes the plot by rerendering it and then pushing the updated data if the plot has an associated Comm.

set_root(root)[source]#

Sets the root model on all subplots.

property state#

The plotting state that gets updated via the update method and used by the renderer to generate output.

traverse(fn=None, specs=None, full_breadth=True)[source]#

Traverses any nested DimensionedPlot returning a list of all plots that match the specs. The specs should be supplied as a list of either Plot types or callables, which should return a boolean given the plot class.

update(key)[source]#

Update the internal state of the Plot to represent the given key tuple (where integers represent frames). Returns this state.

update_frame(key, ranges=None)[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.plot.GenericLayoutPlot(layout, **params)[source]#

Bases: GenericCompositePlot

A GenericLayoutPlot accepts either a Layout or a NdLayout and displays the elements in a cartesian grid in scanline order.

Parameters inherited from:

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

transpose = param.Boolean(allow_refs=False, default=False, label=’Transpose’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b622450>)

Whether to transpose the layout when plotting. Switches from row-based left-to-right and top-to-bottom scanline order to column-based top-to-bottom and left-to-right order.

cleanup()[source]#

Cleans up references to the plot on the attached Stream subscribers.

compute_ranges(obj, key, ranges)[source]#

Given an object, a specific key, and the normalization options, this method will find the specified normalization options on the appropriate OptionTree, group the elements according to the selected normalization option (i.e. either per frame or over the whole animation) and finally compute the dimension ranges in each group. The new set of ranges is returned.

initialize_plot(ranges=None)[source]#

Initialize the matplotlib figure.

matches(spec)[source]#

Matches a specification against the current Plot.

push()[source]#

Pushes plot updates to the frontend.

refresh(**kwargs)[source]#

Refreshes the plot by rerendering it and then pushing the updated data if the plot has an associated Comm.

set_root(root)[source]#

Sets the root model on all subplots.

property state#

The plotting state that gets updated via the update method and used by the renderer to generate output.

traverse(fn=None, specs=None, full_breadth=True)[source]#

Traverses any nested DimensionedPlot returning a list of all plots that match the specs. The specs should be supplied as a list of either Plot types or callables, which should return a boolean given the plot class.

update(key)[source]#

Update the internal state of the Plot to represent the given key tuple (where integers represent frames). Returns this state.

class holoviews.plotting.plot.GenericOverlayPlot(overlay, ranges=None, batched=True, keys=None, group_counter=None, **params)[source]#

Bases: GenericElementPlot

Plotting baseclass to render (Nd)Overlay objects. It implements methods to handle the creation of ElementPlots, coordinating style groupings and zorder for all layers across a HoloMap. It also allows collapsing of layers via the Compositor.

Parameters inherited from:

holoviews.plotting.plot.DimensionedPlot: fontsize, fontscale, show_title, 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, xticks, yticks

show_legend = param.Boolean(allow_refs=False, default=True, label=’Show legend’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b648790>)

Whether to show legend for the plot.

batched = param.Boolean(allow_refs=False, default=True, label=’Batched’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b647c90>)

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

legend_limit = param.Integer(allow_refs=False, default=25, inclusive_bounds=(True, True), label=’Legend limit’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b6b81d0>)

Number of rendered glyphs before legends are disabled.

style_grouping = param.Integer(allow_refs=False, default=2, inclusive_bounds=(True, True), label=’Style grouping’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b6b8890>)

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.

cleanup()[source]#

Cleans up references to the plot on the attached Stream subscribers.

compute_ranges(obj, key, ranges)[source]#

Given an object, a specific key, and the normalization options, this method will find the specified normalization options on the appropriate OptionTree, group the elements according to the selected normalization option (i.e. either per frame or over the whole animation) and finally compute the dimension ranges in each group. The new set of ranges is returned.

get_aspect(xspan, yspan)[source]#

Should define the aspect ratio of the plot.

get_extents(overlay, ranges, range_type='combined', dimension=None, **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.

get_padding(obj, extents)[source]#

Computes padding along the axes taking into account the plot aspect.

get_zorder(overlay, key, el)[source]#

Computes the z-order of element in the NdOverlay taking into account possible batching of elements.

initialize_plot(ranges=None)[source]#

Initialize the matplotlib figure.

matches(spec)[source]#

Matches a specification against the current Plot.

push()[source]#

Pushes plot updates to the frontend.

refresh(**kwargs)[source]#

Refreshes the plot by rerendering it and then pushing the updated data if the plot has an associated Comm.

set_root(root)[source]#

Sets the root model on all subplots.

property state#

The plotting state that gets updated via the update method and used by the renderer to generate output.

traverse(fn=None, specs=None, full_breadth=True)[source]#

Traverses any nested DimensionedPlot returning a list of all plots that match the specs. The specs should be supplied as a list of either Plot types or callables, which should return a boolean given the plot class.

update(key)[source]#

Update the internal state of the Plot to represent the given key tuple (where integers represent frames). Returns this state.

update_frame(key, ranges=None)[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.plot.Plot(renderer=None, root=None, **params)[source]#

Bases: Parameterized

Base class of all Plot classes in HoloViews, designed to be general enough to use any plotting package or backend.

cleanup()[source]#

Cleans up references to the plot on the attached Stream subscribers.

initialize_plot(ranges=None)[source]#

Initialize the matplotlib figure.

push()[source]#

Pushes plot updates to the frontend.

refresh(**kwargs)[source]#

Refreshes the plot by rerendering it and then pushing the updated data if the plot has an associated Comm.

set_root(root)[source]#

Sets the root model on all subplots.

property state#

The plotting state that gets updated via the update method and used by the renderer to generate output.

update(key)[source]#

Update the internal state of the Plot to represent the given key tuple (where integers represent frames). Returns this state.

class holoviews.plotting.plot.PlotSelector(selector, plot_classes, allow_mismatch=False)[source]#

Bases: object

Proxy that allows dynamic selection of a plotting class based on a function of the plotted object. Behaves like a Plot class and presents the same parameterized interface.


renderer Module#

Public API for all plotting renderers supported by HoloViews, regardless of plotting package or backend.

class holoviews.plotting.renderer.Renderer(*, backend, center, css, dpi, fig, fps, holomap, mode, post_render_hooks, size, widget_location, widget_mode, info_fn, key_fn, name)[source]#

Bases: Exporter

The job of a Renderer is to turn the plotting state held within Plot classes into concrete, visual output in the form of the PNG, SVG, MP4 or WebM formats (among others). Note that a Renderer is a type of Exporter and must therefore follow the Exporter interface.

The Renderer needs to be able to use the .state property of the appropriate Plot classes associated with that renderer in order to generate output. The process of ‘drawing’ is execute by the Plots and the Renderer turns the final plotting state into output.

key_fn = param.Callable(allow_None=True, allow_refs=False, constant=True, label=’Key fn’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16b599690>)

Renderers do not support the saving of object key metadata

info_fn = param.Callable(allow_None=True, allow_refs=False, constant=True, label=’Info fn’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16c14f9d0>)

Renderers do not support the saving of object info metadata

center = param.Boolean(allow_refs=False, default=True, label=’Center’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16c10d890>)

Whether to center the plot

backend = param.String(allow_refs=False, default=’’, label=’Backend’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16c14f110>)

The full, lowercase name of the rendering backend or third part plotting package used e.g. ‘matplotlib’ or ‘cairo’.

dpi = param.Integer(allow_None=True, allow_refs=False, inclusive_bounds=(True, True), label=’Dpi’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16a3237d0>)

The render resolution in dpi (dots per inch)

fig = param.Selector(allow_refs=False, default=’auto’, label=’Fig’, names={}, nested_refs=False, objects=[‘auto’], rx=<param.reactive.reactive_ops object at 0x16c14f110>)

Output render format for static figures. If None, no figure rendering will occur.

fps = param.Number(allow_refs=False, default=20, inclusive_bounds=(True, True), label=’Fps’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16c0f96d0>)

Rendered fps (frames per second) for animated formats.

holomap = param.Selector(allow_refs=False, default=’auto’, label=’Holomap’, names={}, nested_refs=False, objects=[‘scrubber’, ‘widgets’, None, ‘auto’], rx=<param.reactive.reactive_ops object at 0x16c14e210>)

Output render multi-frame (typically animated) format. If None, no multi-frame rendering will occur.

mode = param.Selector(allow_refs=False, default=’default’, label=’Mode’, names={}, nested_refs=False, objects=[‘default’, ‘server’], rx=<param.reactive.reactive_ops object at 0x163c4fdd0>)

Whether to render the object in regular or server mode. In server mode a bokeh Document will be returned which can be served as a bokeh server app. By default renders all output is rendered to HTML.

size = param.Integer(allow_refs=False, default=100, inclusive_bounds=(True, True), label=’Size’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16c14d650>)

The rendered size as a percentage size

widget_location = param.Selector(allow_None=True, allow_refs=False, label=’Widget location’, names={}, nested_refs=False, objects=[‘left’, ‘bottom’, ‘right’, ‘top’, ‘top_left’, ‘top_right’, ‘bottom_left’, ‘bottom_right’, ‘left_top’, ‘left_bottom’, ‘right_top’, ‘right_bottom’], rx=<param.reactive.reactive_ops object at 0x16c0f96d0>)

The position of the widgets relative to the plot.

widget_mode = param.Selector(allow_refs=False, default=’embed’, label=’Widget mode’, names={}, nested_refs=False, objects=[‘embed’, ‘live’], rx=<param.reactive.reactive_ops object at 0x16c14ff50>)

The widget mode determining whether frames are embedded or generated ‘live’ when interacting with the widget.

css = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={}, label=’Css’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16c082450>)

Dictionary of CSS attributes and values to apply to HTML output.

post_render_hooks = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={‘svg’: [], ‘png’: []}, label=’Post render hooks’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16c14ef50>)

Optional dictionary of hooks that are applied to the rendered data (according to the output format) before it is returned. Each hook is passed the rendered data and the object that is being rendered. These hooks allow post-processing of rendered data before output is saved to file or displayed.

app(plot, show=False, new_window=False, websocket_origin=None, port=0)[source]#

Creates a bokeh app from a HoloViews object or plot. By default simply attaches the plot to bokeh’s curdoc and returns the Document, if show option is supplied creates an Application instance and displays it either in a browser window or inline if notebook extension has been loaded. Using the new_window option the app may be displayed in a new browser tab once the notebook extension has been loaded. A websocket origin is required when launching from an existing tornado server (such as the notebook) and it is not on the default port (‘localhost:8888’).

comm_manager[source]#

alias of CommManager

components(obj, fmt=None, comm=True, **kwargs)[source]#

Returns data and metadata dictionaries containing HTML and JS components to include render in app, notebook, or standalone document.

classmethod encode(entry)[source]#

Classmethod that applies conditional encoding based on mime-type. Given an entry as returned by __call__ return the data in the appropriate encoding.

export_widgets(obj, filename, fmt=None, template=None, json=False, json_path='', **kwargs)[source]#

Render and export object as a widget to a static HTML file. Allows supplying a custom template formatting string with fields to interpolate ‘js’, ‘css’ and the main ‘html’ containing the widget. Also provides options to export widget data to a json file in the supplied json_path (defaults to current path).

get_plot(obj, doc=None, renderer=None, comm=None, **kwargs)[source]#

Given a HoloViews Viewable return a corresponding plot instance.

get_plot_state(obj, renderer=None, **kwargs)[source]#

Given a HoloViews Viewable return a corresponding plot state.

get_size(plot)[source]#

Return the display size associated with a plot before rendering to any particular format. Used to generate appropriate HTML display.

Returns a tuple of (width, height) in pixels.

html(obj, fmt=None, css=None, resources='CDN', **kwargs)[source]#

Renders plot or data structure and wraps the output in HTML. The comm argument defines whether the HTML output includes code to initialize a Comm, if the plot supplies one.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

classmethod load_nb(inline=False, reloading=False, enable_mathjax=False)[source]#

Loads any resources required for display of plots in the Jupyter notebook

classmethod plot_options(obj, percent_size)[source]#

Given an object and a percentage size (as supplied by the %output magic) return all the appropriate plot options that would be used to instantiate a plot class for that element.

Default plot sizes at the plotting class level should be taken into account.

classmethod plotting_class(obj)[source]#

Given an object or Element class, return the suitable plotting class needed to render it with the current renderer.

save(obj, basename, fmt='auto', key=None, info=None, options=None, resources='inline', title=None, **kwargs)[source]#

Save a HoloViews object to file, either using an explicitly supplied format or to the appropriate default.

server_doc(obj, doc=None)[source]#

Get a bokeh Document with the plot attached. May supply an existing doc, otherwise bokeh.io.curdoc() is used to attach the plot to the global document instance.

classmethod state()[source]#

Context manager to handle global state for a backend, allowing Plot classes to temporarily override that state.

static_html(obj, fmt=None, template=None)[source]#

Generates a static HTML with the rendered object in the supplied format. Allows supplying a template formatting string with fields to interpolate ‘js’, ‘css’ and the main ‘html’.

classmethod validate(options)[source]#

Validate an options dictionary for the renderer.


util Module#

class holoviews.plotting.util.CMapInfo(name, provider, category, source, bg)#

Bases: tuple

bg#

Alias for field number 4

category#

Alias for field number 2

count(value, /)#

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)#

Return first index of value.

Raises ValueError if the value is not present.

name#

Alias for field number 0

provider#

Alias for field number 1

source#

Alias for field number 3

class holoviews.plotting.util.Warning(*, name)[source]#

Bases: Parameterized

class holoviews.plotting.util.apply_nodata(*, nodata, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Parameters inherited from:

holoviews.core.operation.Operation: group, dynamic, input_ranges, streams

link_inputs = param.Boolean(allow_refs=False, default=True, label=’Link inputs’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16c569cd0>)

If the operation is dynamic, whether or not linked streams should be transferred from the operation inputs for backends that support linked streams. For example if an operation is applied to a DynamicMap with an RangeXY, this switch determines whether the corresponding visualization should update this stream with range changes originating from the newly generated axes.

nodata = param.Integer(allow_None=True, allow_refs=False, inclusive_bounds=(True, True), label=’Nodata’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16c56a610>)

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.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

The process_element method allows a single element to be operated on given an externally supplied key.

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

holoviews.plotting.util.attach_streams(plot, obj, precedence=1.1)[source]#

Attaches plot refresh to all streams on the object.

class holoviews.plotting.util.categorical_legend(*, backend, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Generates a Points element which contains information for generating a legend by inspecting the pipeline of a datashaded RGB element.

Parameters inherited from:

holoviews.core.operation.Operation: group, dynamic, input_ranges, link_inputs, streams

backend = param.String(allow_refs=False, default=’’, label=’Backend’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16c2f3190>)

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

The process_element method allows a single element to be operated on given an externally supplied key.

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

holoviews.plotting.util.color_intervals(colors, levels, clip=None, N=255)[source]#

Maps the supplied colors into bins defined by the supplied levels. If a clip tuple is defined the bins are clipped to the defined range otherwise the range is computed from the levels and returned.

Arguments#

colors: list

List of colors (usually hex string or named colors)

levels: list or array_like

Levels specifying the bins to map the colors to

clip: tuple (optional)

Lower and upper limits of the color range

N: int

Number of discrete colors to map the range onto

Returns#

cmap: list

List of colors

clip: tuple

Lower and upper bounds of the color range

holoviews.plotting.util.compute_overlayable_zorders(obj, path=None)[source]#

Traverses an overlayable composite container to determine which objects are associated with specific (Nd)Overlay layers by z-order, making sure to take DynamicMap Callables into account. Returns a mapping between the zorders of each layer and a corresponding lists of objects.

Used to determine which overlaid subplots should be linked with Stream callbacks.

holoviews.plotting.util.compute_sizes(sizes, size_fn, scaling_factor, scaling_method, base_size)[source]#

Scales point sizes according to a scaling factor, base size and size_fn, which will be applied before scaling.

holoviews.plotting.util.dim_axis_label(dimensions, separator=', ')[source]#

Returns an axis label for one or more dimensions.

holoviews.plotting.util.dim_range_key(eldim)[source]#

Returns the key to look up a dimension range.

holoviews.plotting.util.displayable(obj)[source]#

Predicate that returns whether the object is displayable or not (i.e. whether the object obeys the nesting hierarchy)

holoviews.plotting.util.dynamic_update(plot, subplot, key, overlay, items)[source]#

Given a plot, subplot and dynamically generated (Nd)Overlay find the closest matching Element for that plot.

class holoviews.plotting.util.flatten_stack(*, shade_params, dynamic, group, input_ranges, link_inputs, streams, name)[source]#

Bases: Operation

Thin wrapper around datashader’s shade operation to flatten ImageStacks into RGB elements.

Used for the MPL and Plotly backends because these backends do not natively support ImageStacks, unlike Bokeh.

Parameters inherited from:

holoviews.core.operation.Operation: group, dynamic, input_ranges, link_inputs, streams

shade_params = param.Dict(allow_refs=False, class_=<class ‘dict’>, default={}, label=’Shade params’, nested_refs=False, rx=<param.reactive.reactive_ops object at 0x16c2f1850>)

Additional parameters passed to datashader’s shade operation.

classmethod get_overlay_bounds(overlay)[source]#

Returns the extents if all the elements of an overlay agree on a consistent extents, otherwise raises an exception.

classmethod get_overlay_label(overlay, default_label='')[source]#

Returns a label if all the elements of an overlay agree on a consistent label, otherwise returns the default label.

classmethod instance(**params)[source]#

Return an instance of this class, copying parameters from any existing instance provided.

process_element(element, key, **params)[source]#

The process_element method allows a single element to be operated on given an externally supplied key.

classmethod search(element, pattern)[source]#

Helper method that returns a list of elements that match the given path pattern of form {type}.{group}.{label}.

The input may be a Layout, an Overlay type or a single Element.

holoviews.plotting.util.get_axis_padding(padding)[source]#

Process a padding value supplied as a tuple or number and returns padding values for x-, y- and z-axis.

holoviews.plotting.util.get_directed_graph_paths(element, arrow_length)[source]#

Computes paths for a directed path which include an arrow to indicate the directionality of each edge.

holoviews.plotting.util.get_dynamic_mode(composite)[source]#

Returns the common mode of the dynamic maps in given composite object

holoviews.plotting.util.get_min_distance(element)[source]#

Gets the minimum sampling distance of the x- and y-coordinates in a grid.

holoviews.plotting.util.get_minimum_span(low, high, span)[source]#

If lower and high values are equal ensures they are separated by the defined span.

holoviews.plotting.util.get_nested_plot_frame(obj, key_map, cached=False)[source]#

Extracts a single frame from a nested object.

Replaces any HoloMap or DynamicMap in the nested data structure, with the item corresponding to the supplied key.

Args:

obj: Nested Dimensioned object key_map: Dictionary mapping between dimensions and key value cached: Whether to allow looking up key in cache

Returns:

Nested datastructure where maps are replaced with single frames

holoviews.plotting.util.get_plot_frame(map_obj, key_map, cached=False)[source]#

Returns the current frame in a mapping given a key mapping.

Args:

obj: Nested Dimensioned object key_map: Dictionary mapping between dimensions and key value cached: Whether to allow looking up key in cache

Returns:

The item in the mapping corresponding to the supplied key.

holoviews.plotting.util.get_range(element, ranges, dimension)[source]#

Computes the data, soft- and hard-range along a dimension given an element and a dictionary of ranges.

holoviews.plotting.util.get_sideplot_ranges(plot, element, main, ranges)[source]#

Utility to find the range for an adjoined plot given the plot, the element, the Element the plot is adjoined to and the dictionary of ranges.

holoviews.plotting.util.hex2rgb(hex)[source]#

“#FFFFFF” -> [255,255,255]

holoviews.plotting.util.initialize_dynamic(obj)[source]#

Initializes all DynamicMap objects contained by the object

holoviews.plotting.util.initialize_unbounded(obj, dimensions, key)[source]#

Initializes any DynamicMaps in unbounded mode.

holoviews.plotting.util.is_dynamic_overlay(dmap)[source]#

Traverses a DynamicMap graph and determines if any components were overlaid dynamically (i.e. by * on a DynamicMap).

holoviews.plotting.util.isoverlay_fn(obj)[source]#

Determines whether object is a DynamicMap returning (Nd)Overlay types.

holoviews.plotting.util.linear_gradient(start_hex, finish_hex, n=10)[source]#

Interpolates the color gradient between to hex colors

holoviews.plotting.util.list_cmaps(provider=None, records=False, name=None, category=None, source=None, bg=None, reverse=None)[source]#

Return colormap names matching the specified filters.

holoviews.plotting.util.map_colors(arr, crange, cmap, hex=True)[source]#

Maps an array of values to RGB hex strings, given a color range and colormap.

holoviews.plotting.util.mplcmap_to_palette(cmap, ncolors=None, categorical=False)[source]#

Converts a matplotlib colormap to palette of RGB hex strings.”

holoviews.plotting.util.overlay_depth(obj)[source]#

Computes the depth of a DynamicMap overlay if it can be determined otherwise return None.

holoviews.plotting.util.polylinear_gradient(colors, n)[source]#

Interpolates the color gradients between a list of hex colors.

holoviews.plotting.util.process_cmap(cmap, ncolors=None, provider=None, categorical=False)[source]#

Convert valid colormap specifications to a list of colors.

holoviews.plotting.util.register_cmaps(category, provider, source, bg, names)[source]#

Maintain descriptions of colormaps that include the following information:

name - string name for the colormap category - intended use or purpose, mostly following matplotlib provider - package providing the colormap directly source - original source or creator of the colormaps bg - base/background color expected for the map

(‘light’,’dark’,’medium’,’any’ (unknown or N/A))

holoviews.plotting.util.resample_palette(palette, ncolors, categorical, cmap_categorical)[source]#

Resample the number of colors in a palette to the selected number.

holoviews.plotting.util.rgb2hex(rgb)[source]#

Convert RGB(A) tuple to hex.

holoviews.plotting.util.scale_fontsize(size, scaling)[source]#

Scales a numeric or string font size.

holoviews.plotting.util.split_dmap_overlay(obj, depth=0)[source]#

Splits a DynamicMap into the original component layers it was constructed from by traversing the graph to search for dynamically overlaid components (i.e. constructed by using * on a DynamicMap). Useful for assigning subplots of an OverlayPlot the streams that are responsible for driving their updates. Allows the OverlayPlot to determine if a stream update should redraw a particular subplot.

holoviews.plotting.util.traverse_setter(obj, attribute, value)[source]#

Traverses the object and sets the supplied attribute on the object. Supports Dimensioned and DimensionedPlot types.

holoviews.plotting.util.undisplayable_info(obj, html=False)[source]#

Generate helpful message regarding an undisplayable object

holoviews.plotting.util.within_range(range1, range2)[source]#

Checks whether range1 is within the range specified by range2.


Subpackages#