holoviews.plotting.bokeh.util module#
- holoviews.plotting.bokeh.util.attach_periodic(plot)[source]#
Attaches plot refresh to all streams on the object.
- holoviews.plotting.bokeh.util.categorize_array(array, dim)[source]#
Uses a Dimension instance to convert an array of values to categorical (i.e. string) values and applies escaping for colons, which bokeh treats as a categorical suffix.
- holoviews.plotting.bokeh.util.cds_column_replace(source, data)[source]#
Determine if the CDS.data requires a full replacement or simply needs to be updated. A replacement is required if untouched columns are not the same length as the columns being updated.
- holoviews.plotting.bokeh.util.colormesh(X, Y)[source]#
Generates line paths for a quadmesh given 2D arrays of X and Y coordinates.
- holoviews.plotting.bokeh.util.compute_layout_properties(width, height, frame_width, frame_height, explicit_width, explicit_height, aspect, data_aspect, responsive, size_multiplier, logger=None)[source]#
Utility to compute the aspect, plot width/height and sizing_mode behavior.
Parameters#
- widthint
Plot width
- heightint
Plot height
- frame_widthint
Plot frame width
- frame_heightint
Plot frame height
- explicit_widthlist
List of user supplied widths
- explicit_heightlist
List of user supplied heights
- aspectfloat
Plot aspect
- data_aspectfloat
Scaling between x-axis and y-axis ranges
- responsiveboolean
Whether the plot should resize responsively
- size_multiplierfloat
Multiplier for supplied plot dimensions
- loggerparam.Parameters
Parameters object to issue warnings on
Returns#
Returns two dictionaries one for the aspect and sizing modes, and another for the plot dimensions.
- holoviews.plotting.bokeh.util.compute_plot_size(plot)[source]#
Computes the size of bokeh models that make up a layout such as figures, rows, columns, and Plot.
- holoviews.plotting.bokeh.util.convert_timestamp(timestamp)[source]#
Converts bokehJS timestamp to datetime64.
- holoviews.plotting.bokeh.util.date_to_integer(date)[source]#
Converts support date types to milliseconds since epoch
Attempts highest precision conversion of different datetime formats to milliseconds since the epoch (1970-01-01 00:00:00). If datetime is a cftime with a non-standard calendar the caveats described in hv.core.util.cftime_to_timestamp apply.
Parameters#
date : Date- or datetime-like object
Returns#
Milliseconds since 1970-01-01 00:00:00
- holoviews.plotting.bokeh.util.decode_bytes(array)[source]#
Decodes an array, list or tuple of bytestrings to avoid python 3 bokeh serialization errors
- holoviews.plotting.bokeh.util.empty_plot(width, height)[source]#
Creates an empty and invisible plot of the specified size.
- holoviews.plotting.bokeh.util.filter_batched_data(data, mapping)[source]#
Iterates over the data and mapping for a ColumnDataSource and replaces columns with repeating values with a scalar. This is purely and optimization for scalar types.
- holoviews.plotting.bokeh.util.filter_toolboxes(plots)[source]#
Filters out toolboxes out of a list of plots to be able to compose them into a larger plot.
- holoviews.plotting.bokeh.util.font_size_to_pixels(size)[source]#
Convert a fontsize to a pixel value
- holoviews.plotting.bokeh.util.get_default(model, name, theme=None)[source]#
Looks up the default value for a bokeh model property.
- holoviews.plotting.bokeh.util.get_tab_title(key, frame, overlay)[source]#
Computes a title for bokeh tabs from the key in the overlay, the element and the containing (Nd)Overlay.
- holoviews.plotting.bokeh.util.glyph_order(keys, draw_order=None)[source]#
Orders a set of glyph handles using regular sort and an explicit sort order. The explicit draw order must take the form of a list of glyph names while the keys should be glyph names with a custom suffix. The draw order may only match subset of the keys and any matched items will take precedence over other entries.
- holoviews.plotting.bokeh.util.hold_policy(document, policy, server=False)[source]#
Context manager to temporary override the hold policy.
- holoviews.plotting.bokeh.util.hold_render(f)[source]#
Decorator that will hold render on a Bokeh ElementPlot until after the method has been called.
- holoviews.plotting.bokeh.util.hsv_to_rgb(hsv)[source]#
Vectorized HSV to RGB conversion, adapted from: https://stackoverflow.com/questions/24852345/hsv-to-rgb-color-conversion
- holoviews.plotting.bokeh.util.layout_padding(plots, renderer)[source]#
Pads Nones in a list of lists of plots with empty plots.
- holoviews.plotting.bokeh.util.match_ax_type(ax, range_type)[source]#
Ensure the range_type matches the axis model being matched.
- holoviews.plotting.bokeh.util.match_dim_specs(specs1, specs2)[source]#
Matches dimension specs used to link axes.
Axis dimension specs consists of a list of tuples corresponding to each dimension, each tuple spec has the form (name, label, unit). The name and label must match exactly while the unit only has to match if both specs define one.
- holoviews.plotting.bokeh.util.match_yaxis_type_to_range(yax, range_type, range_name)[source]#
Apply match_ax_type to the y-axis found by the given range name
- holoviews.plotting.bokeh.util.merge_tools(plot_grid, *, disambiguation_properties=None, hide_toolbar=False)[source]#
Merges tools defined on a grid of plots into a single toolbar. All tools of the same type are merged unless they define one of the disambiguation properties. By default name, icon, tags and description can be used to prevent tools from being merged.
- holoviews.plotting.bokeh.util.multi_polygons_data(element)[source]#
Expands polygon data which contains holes to a bokeh multi_polygons representation. Multi-polygons split by nans are expanded and the correct list of holes is assigned to each sub-polygon.
- holoviews.plotting.bokeh.util.pad_plots(plots)[source]#
Accepts a grid of bokeh plots in form of a list of lists and wraps any DataTable or Tabs in a Column with appropriate padding. Required to avoid overlap in gridplot.
- holoviews.plotting.bokeh.util.pad_width(model, table_padding=0.85, tabs_padding=1.2)[source]#
Computes the width of a model and sets up appropriate padding for Tabs and DataTable types.
- class holoviews.plotting.bokeh.util.periodic(document)[source]#
Bases:
object
Mocks the API of periodic Thread in hv.core.util, allowing a smooth API transition on bokeh server.
- holoviews.plotting.bokeh.util.property_to_dict(x)[source]#
Convert Bokeh’s property Field and Value to a dictionary
- holoviews.plotting.bokeh.util.recursive_model_update(model, props)[source]#
Recursively updates attributes on a model including other models. If the type of the new model matches the old model properties are simply updated, otherwise the model is replaced.
- holoviews.plotting.bokeh.util.remove_legend(plot, legend)[source]#
Removes a legend from a bokeh plot.
- holoviews.plotting.bokeh.util.select_legends(holoviews_layout, figure_index=None, legend_position='top_right')[source]#
Only displays selected legends in plot layout.
Parameters#
- holoviews_layoutHoloviews Layout
Holoviews Layout with legends.
- figure_indexlist[int] | bool | int | None
Index of the figures which legends to show. If None is chosen, only the first figures legend is shown If True is chosen, all legends are shown.
- legend_positionstr
Position of the legend(s).
- holoviews.plotting.bokeh.util.silence_warnings(*warnings)[source]#
Context manager for silencing bokeh validation warnings.
- holoviews.plotting.bokeh.util.sync_legends(bokeh_layout)[source]#
This syncs the legends of all plots in a grid based on their name.
Parameters#
- bokeh_layoutbokeh.models.{GridPlot, Row, Column}
Gridplot to sync legends of.
Context manager to ensures data sources shared between multiple plots are cleared and updated appropriately avoiding warnings and allowing empty frames on subplots. Expects a list of shared_sources and a mapping of the columns expected columns for each source in the plots handles.