NetworkArtist
- class compas.artists.NetworkArtist(item, **kwargs)[source]
Bases:
Artist
Artist for drawing network data structures.
- Parameters
network (
Network
) – A COMPAS network.nodes (list[hashable], optional) – A list of node identifiers. Default is None, in which case all nodes are drawn.
edges (list[tuple[hashable, hashable]], optional) – A list of edge keys (as uv pairs) identifying which edges to draw. The default is None, in which case all edges are drawn.
nodecolor (
Color
| dict[hashable,Color
], optional) – The color specification for the nodes.edgecolor (
Color
| dict[tuple[hashable, hashable]],Color
], optional) – The color specification for the edges.
- Attributes
network (
Network
) – The COMPAS network associated with the artist.nodes (list[hashable]) – The list of nodes to draw. Defaults to all nodes.
edges (list[tuple[hashable, hashable]]) – The list of edges to draw. Default is a list of all edges of the network.
node_xyz (dict[hashable, list[float]]) – Mapping between nodes and their view coordinates. The default view coordinates are the actual coordinates of the nodes of the network.
node_color (dict[hashable,
Color
]) – Mapping between nodes and RGB color values. Missing nodes get the default node colordefault_nodecolor
.edge_color (dict[tuple[hashable, hashable],
Color
]) – Mapping between edges and colors. Missing edges get the default edge colordefault_edgecolor
.node_text (dict[hashable, str]) – Mapping between nodes and text labels.
edge_text (dict[tuple[hashable, hashable], str]) – Mapping between edges and text labels.
node_size (dict[hashable, float]) – Mapping between nodes and sizes. Missing nodes get assigned the default node size
default_nodesize
.edge_width (dict[tuple[hashable, hashable], float]) – Mapping between edges and line widths. Missing edges get assigned the default edge width
default_edgewidth
.
- Class Attributes
default_nodecolor (
Color
) – The default color for nodes that do not have a specified color.default_edgecolor (
Color
) – The default color for edges that do not have a specified color.default_nodesize (float) – The default size for nodes that do not have a specified size.
default_edgewidth (float) – The default width for edges that do not have a specified width.
Methods
Clear the nodes and the edges of the network.
Clear the edges of the network.
Clear the nodes of the network.
Draw the edges of the network.
Draw the nodes of the network.
Inherited Methods
Build an artist corresponding to the item type.
Build an artist with the given type.
The main drawing method.
Drawing method for drawing an entire collection of objects.
Redraw the view.
Register an artist type to a data type.