Plotting

treecat.plotting

treecat.plotting.add_panning_to_svg(source, destin=None)

Add pan and zoom to an svg file by embedding SVGPan in the file.

Args:
source: Path to the input file. destin: Path to the output file. Defaults to source.
treecat.plotting.contract_positions(XY, edges, stepsize)

Perturb vertex positions by an L1-minimizing attractive force.

This is used to slightly adjust vertex positions to provide a visual hint to their grouping.

Args:
XY: A [V, 2]-shaped numpy array of the current positions. edges: An [E, 2]-shaped numpy array of edges as (vertex,vertex) pairs.
treecat.plotting.layout_tree(correlation)

Layout tree for visualization with e.g. matplotlib.

Args:
correlation: A [V, V]-shaped numpy array of latent correlations.
Returns:
A [V, 3]-shaped numpy array of spectral positions of vertices.
treecat.plotting.nx_plot_tree(server, node_size=200, **options)

Visualize the tree using the networkx package.

This plots to the current matplotlib figure.

Args:
server: A DataServer instance. options: Options passed to networkx.draw().
treecat.plotting.plot_chord(begin, end, spacing, color, alpha=None)

Plots a circular chord from begin to end.

This assumes that the outer circle is centered at (0,0).

Args:
begin: A [2]-shaped numpy array. end: A [2]-shaped numpy array. spacing: A float, extra spacing around the edge of the circle. color: A matplotlib color spec. apha: A float or None.
treecat.plotting.plot_circular(server, tree_samples=0, fontsize=8, color='#4488aa', contract=0.08)

Plot a tree stucture with features arranged around a circle.

Args:

server: A DataServer instance. tree_samples: Number of trees to sample, in addition to the mode. fontsize: The font size for labels, in points. color: A matplotlib color spec for edge colors. contract: Contract vertex positions by this amount to visually hint

their grouping.
Requires:
matplotlib.
treecat.plotting.plot_feature_overlap(df, cmap='binary', method='cluster')

Plot feature-feature presence overlap of a pandas dataframe.

Args:
df: A pandas dataframe. cmap: A matplotlib colormap. method: Method of clustering, one of ‘cluster’ or ‘tree’.