1
$\begingroup$

I have tried to make a graph out of x,y co-ordinates from an area and display it using matplotlib but all the nodes sort of got overlapped as there is little difference between the when compared to the co-ordinates so I need a way to define a bounding box and the scale with which it is supposed to draw the graph [1]: http://imgur.com/6Hwc1

    for i in a:
        print i
        cur_point = tuple([float(x) for x in i.split(' ')])
        print cur_point
        assert len(cur_point) == 2
        if prev_point is not None:
            b = cur_point[1] - prev_point[1]
            c = cur_point[0] - prev_point[0]
            a = math.sqrt(b ** 2 + c ** 2)
            G.add_edge(cur_point, prev_point, weight=a)
        G.add_node(cur_point)
        posi[cur_point] = cur_point
        prev_point = cur_point
nx.draw(G, pos=posi)
plt.savefig('roads.png')
  • 0
    Another possibility is to just rescale the coordinates of the vertices.2012-05-29

0 Answers 0