Matplotlib autoscale

Not sure if this what you wanted, but I can change it if this was not what you were looking for.

import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection

import pylab as p

fig = plt.figure()
pts1 = []
pts2 = []
for i in range(100):
    pts1.append([i,i])
    pts2.append([-i-3,-i])
lines = LineCollection([pts1,pts2], linestyles="solid")
subplt = fig.add_subplot(111,aspect="equal")
subplt.add_collection(lines)
subplt.autoscale_view(True,True,True)
p.show()

Hope that helps.

Leave a Comment