plot_tree
Plot a lineage tree with optional annotation bars alongside leaves. Add character matrices, gene expression, or metadata to explore lineage relationships.
Instructions
Plot a lineage tree, optionally with a character-matrix / annotation heatmap.
Renders with pycea and returns the figure inline plus the path it was saved to.
Use keys to draw annotation bars beside the leaves -- pass the character-matrix
obsm key (e.g. "characters"), obs columns, or gene names to visualize alongside
the tree.
Args: dataset_id: Dataset handle. tree_key: Which tree in obst to plot. keys: Annotation(s) to draw beside the tree (obsm key, obs cols, or var_names). polar: Draw the tree radially instead of rectangularly. branch_color: Edge color, or an edge/obs attribute name to color by. node_color: Optional node color or attribute name. annotation_width: Width of each annotation column (fraction of plot). depth_key: Node attribute to use for depth/branch lengths (default: topological). width: Figure width in inches. height: Figure height in inches. dpi: Figure resolution. save_path: Where to write the PNG (default: /plots/_.png).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dpi | No | ||
| keys | No | ||
| polar | No | ||
| width | No | ||
| height | No | ||
| tree_key | Yes | ||
| depth_key | No | ||
| save_path | No | ||
| dataset_id | Yes | ||
| node_color | No | ||
| branch_color | No | black | |
| annotation_width | No |