Plotting#

Matplotlib backend#

densitree.plot.matplotlib.plot_tree(result: SPADEResult, color_by: int | str | None = None, size_by: str = 'count') plt.Figure[source]#

Draw the SPADE MST as a static matplotlib figure.

Parameters:
  • result (SPADEResult)

  • color_by (int | str | None) – Feature index or name to color nodes by median expression.

  • size_by (str) – 'count' scales node area by cell count; anything else → uniform.

Returns:

matplotlib.figure.Figure

Plotly backend#

densitree.plot.plotly.plot_tree(result: SPADEResult, color_by: int | str | None = None, size_by: str = 'count')[source]#

Draw the SPADE MST as an interactive plotly figure.

Parameters:
  • result (SPADEResult)

  • color_by (int | str | None) – Feature index or name to color nodes by median expression.

  • size_by (str) – 'count' scales node size by cell count; anything else → uniform.

Returns:

plotly.graph_objects.Figure