ragraph.plot.components.piemap
#
Re-usable mapping plot component.
The mapping plot is a matrix of pie-charts, indicating the edges between leaf nodes.
The nodes are identically placed from left-to-right as well as top-to-bottom. This results in a diagonal (from top-left to bottom-right) of ‘self loops’, which are commonly used to indicate “the nodes themselves”.
The pie-charts can represent a number of things, including edge weights, edge labels as well as other metrics. The node hierarchy is included using squares drawn around the diagonal.
Furthermore, bus nodes have their respective row and column in a shaded background color. This sets apart the buses’ “highly integrative” edges from the regular edges between nodes.
Module Contents#
Classes#
A map of piecharts plot component. |
Functions#
|
Get grid traces and shapes for the mapping plot component. |
|
Get highlight bands for both rows and columns. |
|
Get piechart traces and shapes for the mapping plot component. |
|
Get (inherited) edge lists between sources (cols) and targets (rows). |
|
Get field values (display values) for each source/target combination. |
|
Get customdata from edges. |
|
Get fields from style mapping or default to all available fields to display. |
|
Check if categorical colors list is of sufficient length (len=10 by default). |
|
Get the field sums for the given edges according to the style. |
|
Get piechart angle dictionary. |
|
Get the field pie-chart angles given their value sums. |
|
Draw pie charts in the order of the given fields. |
|
Get hierarchy shapes for the mapping plot component. |
|
Get kind shapes for the mapping plot component. |
- class ragraph.plot.components.piemap.PieMap(rows: List[ragraph.node.Node], cols: List[ragraph.node.Node], edges: List[ragraph.edge.Edge] = [], style: ragraph.plot.generic.Style = Style(), **kwargs)#
Bases:
ragraph.plot.generic.Component
A map of piecharts plot component.
This map, or matrix, of pie-charts display the edges between leaf nodes.
- Parameters:
rows – The nodes to be placed on the rows of the matrix.
cols – The columns to be placed on the columns of the matrix.
edges – Edges to be displayed between leaf nodes.
style – Plot style option mapping.
rows – The nodes to be placed on the rows of the matrix.
cols – The columns to be placed on the columns of the matrix.
Note
The pie-charts can represent a number of things, including edge weights, edge labels as well as other metrics. The node hierarchy is included using squares drawn around the diagonal.
Furthermore, bus nodes have their respective row and column in a shaded background color. This sets apart the buses’ “highly integrative” edges from the regular edges between nodes.
- ragraph.plot.components.piemap._get_grid_shapes(rows: List[ragraph.node.Node], cols: List[ragraph.node.Node], style: ragraph.plot.generic.Style)#
Get grid traces and shapes for the mapping plot component.
- Parameters:
rows – The nodes to be placed on the rows of the matrix.
cols – The columns to be placed on the columns of the matrix.
style – Plot style mapping.
- ragraph.plot.components.piemap._get_highlight_shapes(rows: List[ragraph.node.Node], cols: List[ragraph.node.Node], style: ragraph.plot.generic.Style) List[Dict[str, Any]] #
Get highlight bands for both rows and columns.
- ragraph.plot.components.piemap._get_pies_data(rows: List[ragraph.node.Node], cols: List[ragraph.node.Node], edges: List[ragraph.edge.Edge], style: ragraph.plot.generic.Style)#
Get piechart traces and shapes for the mapping plot component.
- Parameters:
rows – List of row nodes.
cols – List of col nodes.
edges – List of edges to draw data from.
style – Plot style mapping.
- ragraph.plot.components.piemap._get_bundle_dict(rows: List[ragraph.node.Node], cols: List[ragraph.node.Node], edges: List[ragraph.edge.Edge], style: ragraph.plot.generic.Style) Dict[Tuple[str, str], List[ragraph.edge.Edge]] #
Get (inherited) edge lists between sources (cols) and targets (rows).
- ragraph.plot.components.piemap._get_fields_dict(bundle_dict: Dict[Tuple[str, str], List[ragraph.edge.Edge]], fields: List[str], style: ragraph.plot.generic.Style) Tuple[Dict[Tuple[str, str], Dict[str, float]], Dict[str, float], Dict[str, float]] #
Get field values (display values) for each source/target combination.
- ragraph.plot.components.piemap._get_customdata(edges: List[ragraph.edge.Edge], style: ragraph.plot.generic.Style) Dict[str, Any] #
Get customdata from edges.
- ragraph.plot.components.piemap._get_fields(edges: List[ragraph.edge.Edge], style: ragraph.plot.generic.Style) List[str] #
Get fields from style mapping or default to all available fields to display.
- ragraph.plot.components.piemap._check_categorical_color_settings(fields: List[str], style: ragraph.plot.generic.Style)#
Check if categorical colors list is of sufficient length (len=10 by default).
- ragraph.plot.components.piemap._get_field_values(edges: List[ragraph.edge.Edge], fields: List[str], style: ragraph.plot.generic.Style) Dict[str, float] #
Get the field sums for the given edges according to the style.
- ragraph.plot.components.piemap._get_equal_angles(fields: List[str]) Dict[str, Tuple[float, float]] #
Get piechart angle dictionary.
- ragraph.plot.components.piemap._get_relative_angles(fields: List[str], sums: Dict[str, float]) Dict[str, Tuple[float, float]] #
Get the field pie-chart angles given their value sums.
- ragraph.plot.components.piemap._get_pie_data(fields: List[str], angles: Dict[str, Tuple[float, float]], values: Dict[str, float], lower: Dict[str, float], upper: Dict[str, float], style: ragraph.plot.generic.Style, customdata: Dict[str, Any], x: float = 0.0, y: float = 0.0, r: float = 0.4)#
Draw pie charts in the order of the given fields.
- ragraph.plot.components.piemap._get_hierarchy_shapes(leafs: List[ragraph.node.Node], style: ragraph.plot.generic.Style)#
Get hierarchy shapes for the mapping plot component.
- Parameters:
leafs – List of leaf nodes.
style – Style of the tree to be plotted.
- Returns:
Processed ancestor nodes. Tree depth. Dictionary of node to x position of tree nodes. Dictionary of node to y position of tree nodes.
- ragraph.plot.components.piemap._get_kind_shapes(leafs: List[ragraph.node.Node], style: ragraph.plot.generic.Style)#
Get kind shapes for the mapping plot component.