ytree.visualization.tree_plot.TreePlot

class ytree.visualization.tree_plot.TreePlot(tree, dot_kwargs=None)[source]

Make a simple merger tree plot using pydot and graphviz.

Parameters:
  • tree (merger tree node TreeNode) – The merger tree to be plotted.
  • dot_kwargs (optional, dict) – A dictionary of keyword arguments to be passed to pydot.Dot. Default: None.
size_field

The field to determine the size of each circle. Default: ‘mass’.

Type:str
size_log

Whether to scale circle sizes based on log of size field. Default: True.

Type:bool
min_mass

The minimum halo mass to be included in the plot. If given as a float, units are assumed to be Msun. Default: None.

Type:float ot YTQuantity
min_mass_ratio

The minimum ratio between a halo’s mass and the mass of the main halo to be included in the plot. Default: None.

Type:float

Examples

>>> import ytree
>>> a = ytree.load("tree_0_0_0.dat")
>>> p = ytree.TreePlot(a[0])
>>> p.min_mass = 1e6 # Msun
>>> p.save()
__init__(tree, dot_kwargs=None)[source]

Initialize a TreePlot.

Methods

__init__(tree[, dot_kwargs]) Initialize a TreePlot.
save([filename]) Save the merger tree plot.

Attributes

min_mass The minimum halo mass to be included in the plot.
min_mass_ratio The minimum halo mass to main halo mass.
size_field The field to determine the size of each circle.
size_log Whether to scale circle sizes based on log of size field.