Tree plot function

cellhint.treeplot(alignment, group_celltype: bool = True, order_dataset: bool = False, link_color: str = '#0000007B', link_width: float | None = None, node_shape: list | str = 'o', node_color: DataFrame | None = None, cmap: Colormap | str = 'Reds', node_size: float | None = None, show_label: bool = True, label_color: str = '#000000', label_size: float | str | None = None, label_ha: str = 'center', label_va: str = 'top', title: str = 'CellHint label harmonization tree', ax: Axes | None = None, figsize: list | tuple | None = None, show: bool = True, save: str | bool = False, link_dict: dict = {}, node_dict: dict = {}, label_dict: dict = {}, expand_label: bool = False) None[source]

Generate a tree showing the CellHint label harmonization in a qualitative manner.

Parameters:
  • alignment – A DistanceAlignment or DataFrame object representing the harmonization result.

  • group_celltype – Whether to group cell types (rows) in the harmonization table for plotting. (N.B. Do not change the default value of this argument unless you know what you are doing.) (Default: True)

  • order_dataset – Whether to change the dataset order in each cell type group to manifest as hierarchy (tree). (Default: False)

  • link_color – Color of links/branches. (Default: ‘#0000007B’)

  • link_width – Width of links/branches in points. Default to 1.5 in a canonical Matplotlib setting.

  • node_shape – Shape of the node. This can also be a list of symbols for datasets that are aligned. (Default: ‘o’)

  • node_color – A DataFrame with three consecutive columns representing dataset, cell type, and color, respectively. Default to a color scheme that allows matched cell types to have the same colors. This can also be a data frame with columns of dataset, cell type, and numeric value (for mapping color gradient).

  • cmap – Color map to use. This parameter is only relevant if node_color is a value-mapping data frame. (Default: ‘Reds’)

  • node_size – Size of nodes (cell types) in points. Default to 6.0 in a canonical Matplotlib setting.

  • show_label – Whether to label each node with its cell type name. (Default: True)

  • label_color – Color of cell type labels. (Default: ‘#000000’)

  • label_size – Size of cell type labels. Default to 10.0 in a canonical Matplotlib setting.

  • label_ha – Horizontal alignment of cell type labels relative to the nodes. (Default: ‘center’)

  • label_va – Vertical alignment of cell type labels relative to the nodes. (Default: ‘top’)

  • title – Figure title. (Default: ‘CellHint label harmonization tree’)

  • ax – An Axes where the tree will be drawn. Default to draw the tree on a new axes.

  • figsize – Tuple of figure width and height in inches. Default to auto-adjusting the figure size based on the numbers of datasets and cell types.

  • show – Whether to show the plot. (Default: True)

  • save – Whether to save the plot. This can also be a figure filename. (Default: False)

  • link_dict – A dict passed to Line2D for setting the links/branches.

  • node_dict – A dict passed to Line2D for setting the nodes.

  • label_dict – A dict passed to Text for setting cell type labels.

  • expand_label – Ignored. Whether to show the unique expanded labels. Only for developer use. (Default: False)

Return type:

None