visualise_family_tree#
- visualise_family_tree(domain, family_tree, color_by=('Collection',), node_size=500, edge_width=2, layout_scale=0.8, add_id_label=True, label_font_size=12, ax=None, add_cbar=True, figure_kwargs={}, vmin=0, vmax=1, cbar_kwargs={})#
Visualise a family tree of objects within a given domain. Arrows are directed from parent to child.
- Parameters:
- domainobject
A muspan domain object.
- family_treenetworkx.DiGraph
A muspan family tree of the objects in the domain.
- color_bytuple, optional
Attributes by which to colour the nodes (default is (‘Collection’,)).
- node_sizeint, optional
Size of the nodes in the plot (default is 500).
- edge_widthint, optional
Width of the edges in the plot (default is 2).
- layout_scalefloat, optionalx
Scale for the layout of the nodes (default is 0.8).
- add_id_labelbool, optional
Whether to add ID labels to the nodes (default is True).
- label_font_sizeint, optional
Font size for the node labels (default is 12).
- axmatplotlib.axes.Axes, optional
The axes on which to plot (default is None).
- add_cbarbool, optional
Whether to add a colour bar to the plot (default is True).
- figure_kwargsdict, optional
Additional keyword arguments for the figure (default is {}).
- vminfloat, optional
Minimum value for colour scaling if continuous label is used (default is 0).
- vmaxfloat, optional
Maximum value for colour scaling if continuous label is used(default is 1).
- cbar_kwargsdict, optional
Additional keyword arguments for the matplotlib colorbar (default is {}).
- Returns:
- figmatplotlib.figure.Figure
The matplotlib figure object.
- axmatplotlib.axes.Axes
The axes object with the plot.
- Raises:
- ValueError
If an unrecognized object type is encountered in the domain.
Notes
This function visualises the family tree of objects within a given domain. Nodes are coloured based on specified attributes, and different shapes are used to represent different object types (point, shape, line).