Hi,
I have started to use pyplot to create graphs, saving the images and
generating an animation from the collection. Pyplot autoscale the
axes, which isn't suitable for an animation. At the moment I reset
them (for every frame) using the xlim / ylim functions:
import matplotlib.pyplot as plt
...
def draw(self):
self.fig = plt.figure()
self.ax = self.fig.add_subplot(1,1,1)
for e in self.graph.E:
x, y = [e.u.x, e.v.x], [e.u.y, e.v.y]
plt.plot(x, y, 'b', zorder=2, lw=3)
for v in self.graph.V:
x, y = [v.x, v.x], [v.y, v.y]
plt.scatter(x, y, c='g', zorder=1, s=120)
# XXX: There should be a better way than this?
plt.xlim( (0, 100) )
plt.ylim( (0, 100) )
Is there a better way to do this?
Thanks,
Blake
|