Regardless of the kinds of inputs supported by the graph API, the mark itself should have the following characteristics:
In [1]:
import numpy
import toyplot
In [2]:
import igraph
numpy.random.seed(1234)
graph = igraph.Graph.GRG(20, 0.5)
graph.summary()
coords = numpy.array(graph.layout("auto").coords)
x = coords[:, 0]
y = coords[:, 1]
source = [edge.source for edge in graph.es]
target = [edge.target for edge in graph.es]
In [3]:
colormap = toyplot.color.LinearMap(toyplot.color.Palette(["white", "yellow", "orange", "red"]))
ecolor = numpy.random.uniform(size=len(graph.es))
vcolor = numpy.random.uniform(size=len(graph.vs))
canvas = toyplot.Canvas(style={"background-color":"#bbb"})
axes = canvas.axes(show=False)
axes.graph(x, y, source, target, edge_color=(ecolor, colormap), edge_opacity=1, vertex_color=(vcolor, colormap), size=100, mstyle={"stroke":"black"})
Out[3]:
In [ ]: