3.2. Draw

The draw functions are helper functions to plot reeb graphs and merge trees.

cereeberus.compute.draw.dict_to_list(d)[source]
cereeberus.compute.draw.line_loop_index(R)[source]

Determine if edges between two nodes should be lines or loops

Parameters:

R (Reeb Graph) – Reeb Graph

Returns:

2-element tuple containing

  • line_index (list) : list of indices for edges to be drawn as lines

  • loop_index (list) : list of indices for edges to be drawn as loops

cereeberus.compute.draw.slope_intercept(pt0, pt1)[source]

Compute slope and intercept to be used in the bezier curve function

Parameters:
  • pt0 (ordered pair) – first point

  • pt1 (ordered pair) – second point

Returns:

2-element tuple containing

  • m (float) : slope

  • b (float) : intercept

cereeberus.compute.draw.bezier_curve(pt0, midpt, pt1)[source]

Compute bezier curves for plotting two edges between a single set of nodes

Parameters:
  • pt0 (ordered pair) – first point

  • midpt (ordered pair) – midpoint for bezier curve to pass through

  • pt1 (ordered pair) – second point

Returns:

array of points to be used in plotting

Return type:

points (np array)

cereeberus.compute.draw.reeb_plot(R, with_labels=True, with_colorbar=False, cpx=0.1, cpy=0.1)[source]

Main plotting function for the Reeb Graph Class

Parameters:
  • R (Reeb Graph) – object of Reeb Graph class

  • with_labels (bool) – parameter to control whether or not to plot labels

  • with_colorbar (bool) – parameter to control whether or not to plot colorbar

  • cp (float) – parameter to control curvature of loops in the plotting function. For vertical Reeb graph, only mess with cpx.