Hive Plot Matrix Visualization#

Visualization functions for rendering HivePlotMatrix instances. The main entry point is hive_plot_matrix_viz(), which dispatches to a layout-specific plotting function based on the matrix type.

hiveplotlib.viz.hiveplot_matrix.hive_plot_matrix_viz(matrix: HivePlotMatrix, **kwargs: object) Tuple[Figure, ndarray] | Tuple[Figure, ndarray, Dict[Tuple[int, int], AxesImage], Dict[Tuple[int, int], AxesImage]]#

Plot a HivePlotMatrix instance.

Dispatches to the appropriate plotting function based on the matrix type:

Parameters:
  • matrixHivePlotMatrix instance.

  • kwargs – keyword arguments forwarded to the plotting function.

Returns:

(fig, axes) for matplotlib, (fig, axes, im_nodes_dict, im_edges_dict) for datashader.

Partition Layout Viz#

hiveplotlib.viz.hiveplot_matrix.plot_from_partition(matrix: HivePlotMatrix, figsize: Tuple[float, float] | None = None, dpi: int = 150, diagonal_buffer: float = 0.3, off_diagonal_buffer: float = 0.2, diagonal_pixel_spread_nodes: int = 4, off_diagonal_pixel_spread_nodes: int = 7, pixel_spread_edges: int = 1, vmax_nodes: float | None = None, vmax_edges: float | None = None, show_node_colorbar: bool = True, show_edge_colorbar: bool = True, show_axes_labels: bool = True, axes_labels_buffer: float = 1.1, axes_labels_fontsize: int = 10, label_fontsize: int = 20, text_kwargs: dict | None = None, **kwargs: object) Tuple[Figure, ndarray] | Tuple[Figure, ndarray, Dict[Tuple[int, int], AxesImage], Dict[Tuple[int, int], AxesImage]]#

Plot a from_partition type HivePlotMatrix.

Parameters:
  • matrixHivePlotMatrix instance.

  • figsize – figure size. Default computes from grid shape (4 * ncols, 4 * nrows).

  • dpi – figure DPI.

  • diagonal_buffer – buffer for diagonal cells.

  • off_diagonal_buffer – buffer for off-diagonal cells.

  • diagonal_pixel_spread_nodes – pixel spread for nodes on diagonal (datashader).

  • off_diagonal_pixel_spread_nodes – pixel spread for nodes off-diagonal (datashader).

  • pixel_spread_edges – pixel spread for edges (datashader).

  • vmax_nodes – shared vmax for node density (datashader). Default None auto-detects based on the maximum across all cells.

  • vmax_edges – shared vmax for edge density (datashader). Default None auto-detects based on the maximum across all cells.

  • show_node_colorbar – whether to show the node density colorbar (datashader).

  • show_edge_colorbar – whether to show the edge density colorbar (datashader).

  • show_axes_labels – whether to show axis labels on each cell.

  • axes_labels_buffer – buffer for axis labels.

  • axes_labels_fontsize – font size for axis labels.

  • label_fontsize – font size for row/column labels.

  • text_kwargs – additional kwargs for axis label text.

  • kwargs – additional kwargs forwarded to per-cell hive plot viz calls.

Returns:

(fig, axes) for matplotlib, (fig, axes, im_nodes_dict, im_edges_dict) for datashader.

Non-Partition Layout Viz#

hiveplotlib.viz.hiveplot_matrix.plot_non_partition(matrix: HivePlotMatrix, figsize: Tuple[float, float] | None = None, dpi: int = 150, buffer: float | None = None, pixel_spread_nodes: int = 5, pixel_spread_edges: int = 1, row_label_rotation: float = 0, vmax_nodes: float | None = None, vmax_edges: float | None = None, show_node_colorbar: bool = True, show_edge_colorbar: bool = True, show_axes_labels: bool = True, axes_labels_buffer: float = 1.1, axes_labels_fontsize: int = 16, label_fontsize: int = 16, text_kwargs: dict | None = None, per_tag_kwargs: Dict[Hashable, dict] | None = None, **kwargs: object) Tuple[Figure, ndarray] | Tuple[Figure, ndarray, Dict[Tuple[int, int], AxesImage], Dict[Tuple[int, int], AxesImage]]#

Plot a non-partition HivePlotMatrix where all cells share identical settings.

Used for "from_variable_sweep", "from_tags", and "generic" matrix types.

Parameters:
  • matrixHivePlotMatrix instance.

  • figsize – figure size. Default (cell_size * ncols, cell_size * nrows) where cell_size is 6 when repeat axes are detected, 4 otherwise.

  • dpi – figure DPI.

  • buffer – buffer for all cells. Default None auto-detects based on whether cells have repeat axes (0.3) or not (0.1).

  • pixel_spread_nodes – pixel spread for nodes (datashader).

  • pixel_spread_edges – pixel spread for edges (datashader).

  • row_label_rotation – rotation angle for row labels. Default 0 (horizontal). Set to 90 for vertical labels when labels are long.

  • vmax_nodes – shared vmax for node density (datashader). Default None auto-detects based on the maximum across all cells.

  • vmax_edges – shared vmax for edge density (datashader). Default None auto-detects based on the maximum across all cells.

  • show_node_colorbar – whether to show the node density colorbar (datashader).

  • show_edge_colorbar – whether to show the edge density colorbar (datashader).

  • show_axes_labels – whether to show axis labels.

  • axes_labels_buffer – buffer for axis labels.

  • axes_labels_fontsize – font size for axis labels.

  • label_fontsize – font size for row/column labels.

  • text_kwargs – additional kwargs for axis label text.

  • per_tag_kwargs – per-tag keyword arguments merged into each cell’s render call, keyed by tag value (e.g. {"Tag0": {"cmap_edges": "viridis"}}). Takes precedence over any per_tag_plot_kwargs stored on the matrix instance. Only has effect for "from_tags" hive plot matrices where each cell has an associated tag.

  • kwargs – additional kwargs forwarded to per-cell plot calls.

Returns:

(fig, axes) for matplotlib, (fig, axes, im_nodes_dict, im_edges_dict) for datashader.