source: orange/orange/doc/Orange/rst/code/network-read.py @ 7771:ec73cd1b51a4

Revision 7771:ec73cd1b51a4, 474 bytes checked in by miha <miha.stajdohar@…>, 3 years ago (diff)

Call new underscore case functions.

Line 
1import Orange.network
2
3from matplotlib import pyplot as plt
4
5# read network from file
6net = Orange.network.Network.read("K5.net")
7
8# read all edges and plot a line
9for u, v in net.get_edges():
10    x1, y1 = net.coors[0][u], net.coors[1][u]
11    x2, y2 = net.coors[0][v], net.coors[1][v]
12    plt.plot([x1, x2], [y1, y2], 'b-')
13
14# read x and y coordinates to Python list
15x = net.coors[0]
16y = net.coors[1]
17
18# plot vertices
19plt.plot(x, y, 'ro')
20plt.savefig("network-read.py.png")
Note: See TracBrowser for help on using the repository browser.