 # Settling y-axis scaling

ok I think I've found the problem and a possible solution:

left, width = 0.1, 0.8
x = range(100)
closes1 = range(100, 200)
closes2 = range(200, 300)
closes3 = range(300, 400)
f = figure(1, facecolor='w', figsize=(10, 7), dpi=96)
rect2 = [left, 0.1, width, 0.8]
axMiddle = axes(rect2, axisbg='#f6f6f6')
axMiddle.yaxis.tick_left()
plot_day_summary2(axMiddle, closes3, closes3, closes3, closes3)
print axMiddle.get_ylim()
axMiddle.plot(x, closes1, color='r', linewidth=1)
print axMiddle.get_ylim()
axMiddle.plot(x, closes2, color='r', linewidth=1)
print axMiddle.get_ylim()

This code prints which is wrong:

(300.0, 400.0)
(100.0, 200.0)
(100.0, 300.0)

However when I move the plot_day_summary2 to the end like:

left, width = 0.1, 0.8
x = range(100)
closes1 = range(100, 200)
closes2 = range(200, 300)
closes3 = range(300, 400)
f = figure(1, facecolor='w', figsize=(10, 7), dpi=96)
rect2 = [left, 0.1, width, 0.8]
axMiddle = axes(rect2, axisbg='#f6f6f6')
axMiddle.yaxis.tick_left()
axMiddle.plot(x, closes1, color='r', linewidth=1)
print axMiddle.get_ylim()
axMiddle.plot(x, closes2, color='r', linewidth=1)
print axMiddle.get_ylim()
plot_day_summary2(axMiddle, closes3, closes3, closes3, closes3)
print axMiddle.get_ylim()

I get the correct value:

(100.0, 200.0)
(100.0, 300.0)
(100.0, 400.0)

···

-----Original Message-----
From: John Hunter [mailto:jdhunter@…4…]
Sent: Thursday, July 29, 2004 11:17 AM
To: Vineet Jain
Subject: Re: [Matplotlib-users] Settling y-axis scaling

> That does not seem to work (or I'm doing something
> wrong). The last call to the function just returns the min
> max from the last plot.

Are you trying to get the min and max across several axes?
ax.get_ylim should return the limits for a single axes which
incorporates the data from several 'plot' commands on that axes. If
you are trying to aggregate across axes, you'll need a different
approach.

If you could post some example code, it would probably help clarify.

JDH