holoviews.plotting.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
- name#
Alias for field number 0
- provider#
Alias for field number 1
- source#
Alias for field number 3
- class holoviews.plotting.util.apply_nodata(*, nodata, dynamic, group, input_ranges, link_inputs, streams, name)[source]#
Bases:
Operation
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: group, dynamic, input_ranges, streamslink_inputs = Boolean(default=True, label='Link inputs')
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 = 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.
- 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.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: group, dynamic, input_ranges, link_inputs, streamsbackend = String(default='', label='Backend')
- 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.
Parameters#
- colorslist
List of colors (usually hex string or named colors)
- levelslist or array_like
Levels specifying the bins to map the colors to
- cliptuple, optional
Lower and upper limits of the color range
- Nint
Number of discrete colors to map the range onto
Returns#
- cmaplist
List of colors
- cliptuple
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.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.
Parameter Definitions
Parameters inherited from:
holoviews.core.operation.Operation
: group, dynamic, input_ranges, link_inputs, streamsshade_params = Dict(class_=<class 'dict'>, default={}, label='Shade params')
Additional parameters passed to datashader’s shade operation.
- 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.
Parameters#
- 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.
Parameters#
- 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]#
Convert hex code to RGB integers “#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.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.