# NetworkArtist

class compas.artists.NetworkArtist(*args, **kwargs)[source]

Bases: Artist

Artist for drawing network data structures.

Parameters

network (compas.datastructures.Network) – A COMPAS network.

Attributes
• network (compas.datastructures.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, tuple[float, float, float]]) – Mapping between nodes and RGB color values. Missing nodes get the default node color default_nodecolor.

• edge_color (dict[tuple[hashable, hashable], tuple[float, float, float]]) – Mapping between edges and colors. Missing edges get the default edge color default_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 (tuple[float, float, float]) – The default color for nodes that do not have a specified color.

• default_edgecolor (tuple[float, float, float]) – 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 Clear the nodes and the edges of the network. clear_edges Clear the edges of the network. clear_nodes Clear the nodes of the network. draw_edges Draw the edges of the network. draw_nodes Draw the nodes of the network.

Inherited Methods

 build Build an artist corresponding to the item type. build_as Build an artist with the given type. draw The main drawing method. draw_collection Drawing method for drawing an entire collection of objects. redraw Redraw the view. register Register an artist type to a data type.