NetworkArtist

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

Bases: compas.artists.artist.Artist

Artist for drawing network data structures.

Parameters

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

Class Attributes
  • default_nodecolor (tuple) – The default color for nodes that do not have a specified color.

  • default_edgecolor (tuple) – The default color for edges that do not have a specified color.

Attributes
  • network (compas.datastructures.Network) – The COMPAS network associated with the artist.

  • nodes (list) – The list of nodes to draw. Default is a list of all nodes of the network.

  • edges (list) – The list of edges to draw. Default is a list of all edges of the network.

  • node_xyz (dict[int, tuple(float, float, 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[int, tuple(int, int, int)]) – Mapping between nodes and RGB color values. The colors have to be integer tuples with values in the range 0-255. Missing nodes get the default node color (MeshArtist.default_nodecolor).

  • node_text (dict[int, str]) – Mapping between nodes and text labels. Missing nodes are labelled with the corresponding node identifiers.

  • edge_color (dict[tuple(int, int), tuple(int, int, int)]) – Mapping between edges and RGB color values. The colors have to be integer tuples with values in the range 0-255. Missing edges get the default edge color (MeshArtist.default_edgecolor).

  • edge_text (dict[tuple(int, int), str]) – Mapping between edges and text labels. Missing edges are labelled with the corresponding edge identifiers.

Methods

build(item, **kwargs)

Build an artist corresponding to the item type.

build_as(item, artist_type, **kwargs)

clear()

clear_edges()

clear_nodes()

draw()

draw_collection(collection)

draw_edges([edges, color, text])

Draw the edges of the network.

draw_nodes([nodes, color, text])

Draw the nodes of the network.

get_artist_cls(data, **kwargs)

redraw()

register(item_type, artist_type)