Holoviews#
holoviews visualizations in hiveplotlib.
Currently, hiveplotlib supports a bokeh and matplotlib backend for holoviews.
- hiveplotlib.viz.holoviews.axes_viz(instance: BaseHivePlot | HivePlot | P2CP, fig: Overlay | None = None, buffer: float = 0.3, show_axes_labels: bool = True, axes_labels_buffer: float = 1.1, axes_labels_fontsize: int = 16, width: float | None = None, height: float | None = None, center_plot: bool = True, axes_off: bool = True, overlay_kwargs: dict | None = None, hover: bool = True, text_kwargs: dict | None = None, **segments_kwargs) Overlay | None#
holoviewsvisualization of axes in aHivePlotorP2CPinstance.- Parameters:
instance –
HivePlotorP2CPinstance for which we want to draw axes.fig – default
Nonebuilds new overlay. If an overlay is specified, axes will be drawn on that overlay.buffer – fraction of the axes past which to buffer x and y dimensions (e.g. setting
bufferwill find the maximum radius spanned by anyAxisinstance and set the x and y bounds as(-max_radius - buffer * max_radius, max_radius + buffer * max_radius)).show_axes_labels – whether to label the hive plot axes in the figure (uses
Axis.long_namefor eachAxis.)axes_labels_buffer – fraction which to radially buffer axes labels (e.g. setting
axes_label_bufferto 1.1 will be 10% further past the end of the axis moving from the origin of the plot).axes_labels_fontsize – font size for axes labels.
width – width of figure. When the
holoviewsbackend is set to"bokeh", width must be specified in pixels, defaulting to 600. When theholoviewsbackend is set to"matplotlib", width must be specified in inches, defaulting to 10. Note: only works if instantiating new figure (e.g.figisNone).height – height of figure. When the
holoviewsbackend is set to"bokeh", height must be specified in pixels, defaulting to 600. When theholoviewsbackend is set to"matplotlib", height must be specified in inches, defaulting to 10. Note: only works if instantiating new figure (e.g.figisNone).center_plot – whether to center the figure on
(0, 0), the currently fixed center that the axes are drawn around by default. Will only run if there is at least one axis ininstance.axes_off – whether to turn off Cartesian x, y axes in the
hv.Overlay(defaultTruehides the x and y axes).overlay_kwargs – additional values to be called in
hv.Overlay().opts()call. Note ifwidthandheightare added here, then they will be prioritized over thewidthandheightparameters.hover – whether to add hover information or not for axes.
Falseexcludes hover information. DefaultTrue. Only works currently for Hive Plots, not P2CPs.text_kwargs – additional kwargs passed to holoviews.Text() call.
segments_kwargs – additional params that will be applied to all hive plot axes. Note, these are kwargs that affect a holoviews.Segments() call.
- Returns:
holoviews.Overlay. If instance cannot be plotted with this function, returnsNone.
- hiveplotlib.viz.holoviews.edge_viz(instance: BaseHivePlot | HivePlot | P2CP, fig: Overlay | None = None, tags: Hashable | List[Hashable] | None = None, width: float | None = None, height: float | None = None, center_plot: bool = True, buffer: float = 0.3, axes_off: bool = True, overlay_kwargs: dict | None = None, hover: bool = True, **contours_kwargs) Overlay | None#
holoviewsvisualization of constructed edges in aHivePlotorP2CPinstance.Note
If
instanceis aHivePlot, then users can provide edge-specific data to plotting keyword arguments by providing column names from theHivePlot.edges.dataDataFrame as values to one of the following options:HivePlot.edge_plotting_keyword_argumentsattribute viaHivePlot.update_edge_plotting_keyword_arguments().HivePlot.edges.edge_viz_kwargsattribute viaHivePlot.edges.update_edge_viz_kwargs().In this call in the provided
contours_kwargs.
If
instanceis aHivePlot, then edge keyword arguments will be prioritized according to the following hierarchy:The most prioritized arguments are the arguments stored in the hive plot
hive_plot_edgesattribute, followed by the providedcontours_kwargs, then the edge keyword argument hierarchy set by the hive plot’sedge_kwarg_hierarchyattribute, and finally theHivePlot.edges.edge_viz_kwargs.If any keyword arguments in the
hive_plot_edgesattribute are also provided in this function’scontours_kwargs, then a warning will be raised.Hover information can only be generated for all edges at once in holoviews with the
bokehbackend, so hover information fields will be dictated by a single tag of data even if different data tags have different dataframe columns.- Parameters:
instance –
HivePlotorP2CPinstance for which we want to draw edges.fig – default
Nonebuilds new overlay. If an overlay is specified, axes will be drawn on that overlay.tags – which tag(s) of data to plot. Default
Noneplots all tags of data. Can supply either a single tag or list of tags.width – width of figure. When the
holoviewsbackend is set to"bokeh", width must be specified in pixels, defaulting to 600. When theholoviewsbackend is set to"matplotlib", width must be specified in inches, defaulting to 10. Note: only works if instantiating new figure (e.g.figisNone).height – height of figure. When the
holoviewsbackend is set to"bokeh", height must be specified in pixels, defaulting to 600. When theholoviewsbackend is set to"matplotlib", height must be specified in inches, defaulting to 10. Note: only works if instantiating new figure (e.g.figisNone).center_plot – whether to center the figure on
(0, 0), the currently fixed center that the axes are drawn around by default. Will only run if there is at least one axis ininstance.buffer – fraction of the axes past which to buffer x and y dimensions (e.g. setting
bufferwill find the maximum radius spanned by anyAxisinstance and set the x and y bounds as(-max_radius - buffer * max_radius, max_radius + buffer * max_radius)).axes_off – whether to turn off Cartesian x, y axes in the
hv.Overlay(defaultTruehides the x and y axes).overlay_kwargs – additional values to be called in
hv.Overlay().opts()call. Note ifwidthandheightare added here, then they will be prioritized over thewidthandheightparameters.hover – whether to add hover information or not for edges.
Falseexcludes hover information. DefaultTrue. Only works currently for Hive Plots, not P2CPs. Hover information will be generated as a function of a single tag of data, even if multiple tags are plotted (see note above for more details).contours_kwargs – additional params that will be applied to all edges on all axes (but kwargs specified beforehand in
hiveplotlib.BaseHivePlot.connect_axes()/hiveplotlib.P2CP.build_edges()orhiveplotlib.BaseHivePlot.add_edge_kwargs()/hiveplotlib.P2CP.add_edge_kwargs()will take priority). To overwrite previously set kwargs, seehiveplotlib.BaseHivePlot.add_edge_kwargs()/hiveplotlib.P2CP.add_edge_kwargs()for more. Note, these are kwargs that affect a holoviews.Contours() call. Edge data values can also be used, see note above for more details.
- Raises:
ValueError – if user tries to use the
"line_color"parameter with theholoviews-bokehback end (only"color"can be used to set the edge color with thebokehback end).- Returns:
holoviews.Overlay. If instance cannot be plotted with this function, returnsNone.
- hiveplotlib.viz.holoviews.hive_plot_viz(hive_plot: BaseHivePlot | HivePlot, fig: Overlay | None = None, tags: Hashable | List[Hashable] | None = None, width: float | None = None, height: float | None = None, center_plot: bool = True, buffer: float = 0.3, show_axes_labels: bool = True, axes_labels_buffer: float = 1.1, axes_labels_fontsize: int = 16, axes_off: bool = True, node_kwargs: dict | None = None, axes_kwargs: dict | None = None, text_kwargs: dict | None = None, overlay_kwargs: dict | None = None, hover: bool | Literal['nodes', 'edges', 'axes'] | list[Literal['nodes', 'edges', 'axes']] = True, **edge_kwargs) Overlay#
Create default
holoviewsvisualization of aHivePlotinstance.Note
Users can provide node-specific data to plotting keyword arguments by providing column names from the
HivePlot.nodes.dataDataFrame as values in either theHivePlot.nodes.node_viz_kwargsdictionary viaHivePlot.update_node_viz_kwargs()or in this call in the providednode_kwargs.Any provided node plotting keyword arguments in
HivePlot.nodes.node_viz_kwargswill be prioritized over any providednode_kwargs.Users can provide edge-specific data to plotting keyword arguments by providing column names from the
HivePlot.edges.dataDataFrame as values to one of the following options:HivePlot.edge_plotting_keyword_argumentsattribute viaHivePlot.update_edge_plotting_keyword_arguments().HivePlot.edges.edge_viz_kwargsattribute viaHivePlot.edges.update_edge_viz_kwargs().In this call in the provided
edge_kwargs.
Edge keyword arguments will be prioritized according to the following hierarchy:
The most prioritized arguments are the arguments stored in the hive plot
hive_plot_edgesattribute, followed by the providededge_kwargs, then the edge keyword argument hierarchy set by the hive plot’sedge_kwarg_hierarchyattribute, and finally theHivePlot.edges.edge_viz_kwargs.If any keyword arguments in the
hive_plot_edgesattribute are also provided in this function’sedge_kwargs, then a warning will be raised.When including edge hover information, this can only be generated for all edges at once in holoviews with the
bokehbackend, so hover information fields will be dictated by a single tag of data even if different data tags have different dataframe columns.When including axis hover information, and a subset of axes has metadata not available on other axes, all axes will show that metadata variable, but the axes without the variable will display the value N/A.
- Parameters:
hive_plot –
HivePlotinstance we want to visualize.fig – default
Nonebuilds new overlay. If an overlay is specified, axes will be drawn on that overlay.tags – which tag(s) of data to plot. Default
Noneplots all tags of data. Can supply either a single tag or list of tags.width – width of figure. When the
holoviewsbackend is set to"bokeh", width must be specified in pixels, defaulting to 600. When theholoviewsbackend is set to"matplotlib", width must be specified in inches, defaulting to 10. Note: only works if instantiating new figure (e.g.figisNone).height – height of figure. When the
holoviewsbackend is set to"bokeh", height must be specified in pixels, defaulting to 600. When theholoviewsbackend is set to"matplotlib", height must be specified in inches, defaulting to 10. Note: only works if instantiating new figure (e.g.figisNone).center_plot – whether to center the figure on
(0, 0), the currently fixed center that the axes are drawn around by default. Will only run if there is at least one axis inhive_plot.buffer – fraction of the axes past which to buffer x and y dimensions (e.g. setting
bufferwill find the maximum radius spanned by anyAxisinstance and set the x and y bounds as(-max_radius - buffer * max_radius, max_radius + buffer * max_radius)).show_axes_labels – whether to label the hive plot axes in the figure (uses
Axis.long_namefor eachAxis.)axes_labels_buffer – fraction which to radially buffer axes labels (e.g. setting
axes_label_bufferto 1.1 will be 10% further past the end of the axis moving from the origin of the plot).axes_labels_fontsize – font size for hive plot axes labels.
axes_off – whether to turn off Cartesian x, y axes in the
hv.Overlay(defaultTruehides the x and y axes).node_kwargs – additional params that will be applied to all hive plot nodes. Note, these are kwargs that affect a holoviews.Points() call. Node data values can also be used, see note above for more details.
axes_kwargs – additional params that will be applied to all hive plot axes. Note, these are kwargs that affect a holoviews.Segments() call.
text_kwargs – additional kwargs passed to holoviews.Text() call.
overlay_kwargs – additional values to be called in
hv.Overlay().opts()call. Note ifwidthandheightare added here, then they will be prioritized over thewidthandheightparameters.hover – whether to add hover information or not for nodes, edges, and / or axes.
Falseexcludes all hover information, while defaultTrueincludes node, edge, and axis hover information. Providing the value"nodes"/"edges"/"axes"adds hover information ONLY for nodes / edges / axes. Users can also provide a list of a subset of these values (e.g. providing["nodes", "edges"]would show all hover info except for axes).edge_kwargs – additional params that will be applied to all edges on all axes (but kwargs specified beforehand in
hiveplotlib.BaseHivePlot.connect_axes()orhiveplotlib.BaseHivePlot.add_edge_kwargs()will take priority). To overwrite previously set kwargs, seehiveplotlib.BaseHivePlot.add_edge_kwargs()for more. Note, these are kwargs that affect a holoviews.Contours() call. Edge data values can also be used, see note above for more details.
- Raises:
ValueError – if user tries to use the
"line_color"parameter with theholoviews-bokehback end (only"color"can be used to set the edge color with thebokehback end).- Returns:
holoviews.Overlay.
- hiveplotlib.viz.holoviews.label_axes(instance: BaseHivePlot | HivePlot | P2CP, fig: Overlay | None = None, axes_labels_buffer: float = 1.1, axes_labels_fontsize: int = 16, buffer: float = 0.3, width: float | None = None, height: float | None = None, center_plot: bool = True, axes_off: bool = True, overlay_kwargs: dict | None = None, **text_kwargs) Overlay | None#
holoviewsvisualization of axis labels in aHivePlotorP2CPinstance.For
HivePlotinstances, each axis’long_nameattribute will be used. ForP2CPinstances, column names in thedataattribute will be used.- Parameters:
instance –
HivePlotorP2CPinstance for which we want to draw axes.fig – default
Nonebuilds new overlay. If an overlay is specified, axes will be drawn on that overlay.axes_labels_buffer – fraction which to radially buffer axes labels (e.g. setting
axes_label_bufferto 1.1 will be 10% further past the end of the axis moving from the origin of the plot).axes_labels_fontsize – font size for axes labels.
buffer – fraction of the axes past which to buffer x and y dimensions (e.g. setting
bufferwill find the maximum radius spanned by anyAxisinstance and set the x and y bounds as(-max_radius - buffer * max_radius, max_radius + buffer * max_radius)).width – width of figure. When the
holoviewsbackend is set to"bokeh", width must be specified in pixels, defaulting to 600. When theholoviewsbackend is set to"matplotlib", width must be specified in inches, defaulting to 10. Note: only works if instantiating new figure (e.g.figisNone).height – height of figure. When the
holoviewsbackend is set to"bokeh", height must be specified in pixels, defaulting to 600. When theholoviewsbackend is set to"matplotlib", height must be specified in inches, defaulting to 10. Note: only works if instantiating new figure (e.g.figisNone).center_plot – whether to center the figure on
(0, 0), the currently fixed center that the axes are drawn around by default. Will only run if there is at least one axis ininstance.axes_off – whether to turn off Cartesian x, y axes in the
hv.Overlay(defaultTruehides the x and y axes).overlay_kwargs – additional values to be called in
hv.Overlay().opts()call. Note ifwidthandheightare added here, then they will be prioritized over thewidthandheightparameters.text_kwargs – additional kwargs passed to holoviews.Text() call.
- Returns:
holoviews.Overlay. If instance cannot be plotted with this function, returnsNone.
- hiveplotlib.viz.holoviews.node_viz(instance: BaseHivePlot | HivePlot | P2CP, fig: Overlay | None = None, width: float | None = None, height: float | None = None, center_plot: bool = True, buffer: float = 0.3, axes_off: bool = True, overlay_kwargs: dict | None = None, hover: bool = True, **points_kwargs) Overlay#
holoviewsvisualization of nodes in aHivePlotorP2CPinstance that have been placed on their axes.Note
If
instanceis aHivePlot, then users can provide node-specific data to plotting keyword arguments by providing column names from theHivePlot.nodes.dataDataFrame as values in either theHivePlot.nodes.node_viz_kwargsdictionary viaHivePlot.update_node_viz_kwargs()or in this call in the providedpoints_kwargs.If
instanceis aHivePlot, then any provided node plotting keyword arguments inHivePlot.nodes.node_viz_kwargswill be prioritized over any providedpoints_kwargs.- Parameters:
instance –
HivePlotorP2CPinstance for which we want to draw nodes.fig – default
Nonebuilds new overlay. If an overlay is specified, axes will be drawn on that overlay.width – width of figure. When the
holoviewsbackend is set to"bokeh", width must be specified in pixels, defaulting to 600. When theholoviewsbackend is set to"matplotlib", width must be specified in inches, defaulting to 10. Note: only works if instantiating new figure (e.g.figisNone).height – height of figure. When the
holoviewsbackend is set to"bokeh", height must be specified in pixels, defaulting to 600. When theholoviewsbackend is set to"matplotlib", height must be specified in inches, defaulting to 10. Note: only works if instantiating new figure (e.g.figisNone).center_plot – whether to center the figure on
(0, 0), the currently fixed center that the axes are drawn around by default. Will only run if there is at least one axis ininstance.buffer – fraction of the axes past which to buffer x and y dimensions (e.g. setting
bufferwill find the maximum radius spanned by anyAxisinstance and set the x and y bounds as(-max_radius - buffer * max_radius, max_radius + buffer * max_radius)).axes_off – whether to turn off Cartesian x, y axes in the
hv.Overlay(defaultTruehides the x and y axes).overlay_kwargs – additional values to be called in
hv.Overlay().opts()call. Note ifwidthandheightare added here, then they will be prioritized over thewidthandheightparameters.hover – whether to add hover information or not for nodes.
Falseexcludes hover information. DefaultTrue. Only works currently for Hive Plots, not P2CPs.points_kwargs – additional params that will be applied to all hive plot nodes. Note, these are kwargs that affect a holoviews.Points() call. Node data values can also be used, see note above for more details.
- Returns:
holoviews.Overlay.
- hiveplotlib.viz.holoviews.p2cp_legend(fig: Overlay, **legend_kwargs) Overlay#
Generate a legend for a
P2CPinstance, where entries in the legend will be tags of data added to the instance.- Parameters:
p2cp –
P2CPinstance we want to visualize.fig –
plotlyfigure on which we will draw the legend.legend_kwargs – additional values to be called in
hv.Overlay().opts()call.
- Returns:
holoviews.Overlay.
- hiveplotlib.viz.holoviews.p2cp_viz(p2cp: P2CP, fig: Overlay | None = None, tags: Hashable | List[Hashable] | None = None, width: float | None = None, height: float | None = None, center_plot: bool = True, buffer: float = 0.3, show_axes_labels: bool = True, axes_labels_buffer: float = 1.1, axes_labels_fontsize: int = 16, axes_off: bool = True, node_kwargs: dict | None = None, axes_kwargs: dict | None = None, text_kwargs: dict | None = None, overlay_kwargs: dict | None = None, **edge_kwargs) Overlay#
Create default
holoviewsvisualization of aP2CPinstance.- Parameters:
p2cp –
P2CPinstance we want to visualize.fig – default
Nonebuilds new overlay. If an overlay is specified, axes will be drawn on that overlay.tags – which tag(s) of data to plot. Default
Noneplots all tags of data. Can supply either a single tag or list of tags.width – width of figure. When the
holoviewsbackend is set to"bokeh", width must be specified in pixels, defaulting to 600. When theholoviewsbackend is set to"matplotlib", width must be specified in inches, defaulting to 10. Note: only works if instantiating new figure (e.g.figisNone).height – height of figure. When the
holoviewsbackend is set to"bokeh", height must be specified in pixels, defaulting to 600. When theholoviewsbackend is set to"matplotlib", height must be specified in inches, defaulting to 10. Note: only works if instantiating new figure (e.g.figisNone).center_plot – whether to center the figure on
(0, 0), the currently fixed center that the axes are drawn around by default. Will only run if there is at least one axis inp2cp.buffer – fraction of the axes past which to buffer x and y dimensions (e.g. setting
bufferwill find the maximum radius spanned by anyAxisinstance and set the x and y bounds as(-max_radius - buffer * max_radius, max_radius + buffer * max_radius)).show_axes_labels – whether to label the P2CP axes in the figure (uses
Axis.long_namefor eachAxis.)axes_labels_buffer – fraction which to radially buffer axes labels (e.g. setting
axes_label_bufferto 1.1 will be 10% further past the end of the axis moving from the origin of the plot).axes_labels_fontsize – font size for P2CP axes labels.
axes_off – whether to turn off Cartesian x, y axes in the
hv.Overlay(defaultTruehides the x and y axes).node_kwargs – additional params that will be applied to all P2CP nodes. Note, these are kwargs that affect a holoviews.Points() call.
axes_kwargs – additional params that will be applied to all P2CP axes. Note, these are kwargs that affect a holoviews.Segments() call.
text_kwargs – additional kwargs passed to holoviews.Text() call.
overlay_kwargs – additional values to be called in
hv.Overlay().opts()call. Note ifwidthandheightare added here, then they will be prioritized over thewidthandheightparameters.edge_kwargs – additional params that will be applied to all edges on all axes (but kwargs specified beforehand in
hiveplotlib.P2CP.build_edges()orhiveplotlib.P2CP.add_edge_kwargs()will take priority). To overwrite previously set kwargs, seehiveplotlib.P2CP.add_edge_kwargs()for more. Note, these are kwargs that affect a holoviews.Contours() call.
- Returns:
holoviews.Overlay.