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.

Attributes

default_edgecolor

default_edgewidth

default_nodecolor

default_nodesize

edge_color

edge_text

edge_width

edges

network

node_color

node_size

node_text

node_xyz

nodes

Inherited Attributes

AVAILABLE_CONTEXTS

CONTEXT

ITEM_ARTIST

Methods

clear

clear_edges

clear_nodes

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

draw

draw_collection

redraw

register