NetworkArtist

class compas_plotters.artists.NetworkArtist(item, **kwargs)[source]

Bases: PlotterArtist, NetworkArtist

Artist for COMPAS network data structures.

Parameters
  • network (Network) – A COMPAS network.

  • nodes (list[int], optional) – Selection of node identifiers. Default is None, in which case all nodes are drawn.

  • edges (list[tuple[int, int]], optional) – Selection of edge identifiers. The default is None, in which case all edges are drawn.

  • nodecolor (tuple[float, float, float] | dict[int, tuple[float, float, float]], optional) – Color specification for the nodes.

  • edgecolor (tuple[float, float, float] | dict[tuple[int, int], tuple[float, float, float]], optional) – Color specification for the edges.

  • show_nodes (bool, optional) – If True, draw the nodes of the network.

  • show_edges (bool, optional) – If True, draw the edges of the network.

  • nodesize (int, optional) – The size of the nodes.

  • sizepolicy ({‘relative’, ‘absolute’}, optional) – The policy for sizing the nodes. If 'relative', the value of nodesize is scaled by the number of nodes. If 'absolute', the value of nodesize is scaled by the resolution of the plotter (:attr:NetworkArtist.plotter.dpi).

Attributes
  • node_size (dict[int, float]) – Mapping between node identifiers and node sizes.

  • zorder_edges (int, read-only) – The stacking order of the edges relative to the base stacking order of the network.

  • zorder_nodes (int, read-only) – The stacking order of the nodes relative to the base stacking order of the network.

Methods

clear_edges

Clear the current edges from the canvas.

clear_nodes

Clear the current nodes from the canvas.

draw

Draw the network.

draw_edgelabels

Draw a selection of edge labels.

draw_edges

Draw a selection of edges.

draw_nodelabels

Draw a selection of node labels.

draw_nodes

Draw a selection of nodes.

Inherited Methods

build

Build an artist corresponding to the item type.

build_as

Build an artist with the given type.

clear

Clear the nodes and the edges of the network.

draw_collection

Drawing method for drawing an entire collection of objects.

redraw

Redraw the view.

register

Register an artist type to a data type.

update_data

Update the data limits of the plotting axes using the visualization data.

viewbox

Compute the bounds of the current view.