Revision: 4887
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4887&view=rev
Author: jswhit
Date: 2008-01-23 05:33:01 -0800 (Wed, 23 Jan 2008)
Log Message:
-----------
remove backwards compatibility kludge for ax.get_position
Modified Paths:
--------------
trunk/toolkits/basemap/examples/contour_demo.py
trunk/toolkits/basemap/examples/panelplot.py
trunk/toolkits/basemap/examples/plotmap.py
trunk/toolkits/basemap/examples/plotmap_masked.py
trunk/toolkits/basemap/examples/plotmap_oo.py
trunk/toolkits/basemap/examples/plotprecip.py
trunk/toolkits/basemap/examples/pnganim.py
trunk/toolkits/basemap/examples/simpletest_oo.py
trunk/toolkits/basemap/examples/test.py
Modified: trunk/toolkits/basemap/examples/contour_demo.py
===================================================================
--- trunk/toolkits/basemap/examples/contour_demo.py 2008-01-23 13:20:03 UTC
(rev 4886)
+++ trunk/toolkits/basemap/examples/contour_demo.py 2008-01-23 13:33:01 UTC
(rev 4887)
@@ -22,11 +22,8 @@
CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
CS = m.contourf(x,y,hgt,15,cmap=cm.jet)
# setup colorbar axes instance.
-# for matplotlib 0.91 and earlier, could do l,b,w,h = ax.get_position()
-# for post 0.91, pos = ax.get_position(); l,b,w,h = pos.bounds
-# this works for both.
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes
colorbar(drawedges=True, cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -52,7 +49,7 @@
CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
CS = m.contourf(x,y,hgt,15,cmap=cm.jet)
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes
colorbar(drawedges=True, cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -78,7 +75,7 @@
CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
CS = m.contourf(x,y,hgt,15,cmap=cm.jet)
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes
colorbar(drawedges=True, cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -104,7 +101,7 @@
CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
CS = m.contourf(x,y,hgt,15,cmap=cm.jet)
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes
colorbar(drawedges=True, cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -131,7 +128,7 @@
CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
CS = m.contourf(x,y,hgt,15,cmap=cm.jet)
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes
colorbar(drawedges=True, cax=cax) # draw colorbar
axes(ax) # make the original axes current again
Modified: trunk/toolkits/basemap/examples/panelplot.py
===================================================================
--- trunk/toolkits/basemap/examples/panelplot.py 2008-01-23 13:20:03 UTC
(rev 4886)
+++ trunk/toolkits/basemap/examples/panelplot.py 2008-01-23 13:33:01 UTC
(rev 4887)
@@ -28,7 +28,7 @@
CS = mnh.contourf(xnh,ynh,hgt,15,cmap=P.cm.Spectral)
# colorbar on bottom.
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = P.axes([l, b-0.05, w, 0.025]) # setup colorbar axes
P.colorbar(cax=cax, orientation='horizontal',ticks=CS.levels[0::4]) # draw
colorbar
P.axes(ax) # make the original axes current again
@@ -51,7 +51,7 @@
CS = msh.contourf(xsh,ysh,hgt,15,cmap=P.cm.Spectral)
# colorbar on bottom.
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = P.axes([l, b-0.05, w, 0.025]) # setup colorbar axes
P.colorbar(cax=cax,orientation='horizontal',ticks=MultipleLocator(320)) # draw
colorbar
P.axes(ax) # make the original axes current again
@@ -74,7 +74,7 @@
CS = mnh.contourf(xnh,ynh,hgt,15,cmap=P.cm.RdBu)
# colorbar on right
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = P.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
P.colorbar(cax=cax, ticks=MultipleLocator(160), format='%4i') # draw colorbar
P.axes(ax) # make the original axes current again
@@ -89,7 +89,7 @@
CS = msh.contourf(xsh,ysh,hgt,15,cmap=P.cm.RdBu)
# colorbar on right.
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = P.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
P.colorbar(cax=cax, ticks=MultipleLocator(160), format='%4i') # draw colorbar
P.axes(ax) # make the original axes current again
Modified: trunk/toolkits/basemap/examples/plotmap.py
===================================================================
--- trunk/toolkits/basemap/examples/plotmap.py 2008-01-23 13:20:03 UTC (rev
4886)
+++ trunk/toolkits/basemap/examples/plotmap.py 2008-01-23 13:33:01 UTC (rev
4887)
@@ -32,11 +32,8 @@
# plot image over map with imshow.
im = m.imshow(topodat,cm.jet)
# setup colorbar axes instance.
-# for matplotlib 0.91 and earlier, could do l,b,w,h = ax.get_position()
-# for post 0.91, pos = ax.get_position(); l,b,w,h = pos.bounds
-# this works for both.
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h])
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
Modified: trunk/toolkits/basemap/examples/plotmap_masked.py
===================================================================
--- trunk/toolkits/basemap/examples/plotmap_masked.py 2008-01-23 13:20:03 UTC
(rev 4886)
+++ trunk/toolkits/basemap/examples/plotmap_masked.py 2008-01-23 13:33:01 UTC
(rev 4887)
@@ -40,11 +40,8 @@
# plot image over map with imshow.
im =
m.imshow(topodatm,palette,norm=colors.normalize(vmin=0.0,vmax=3000.0,clip=False))
# setup colorbar axes instance.
-# for matplotlib 0.91 and earlier, could do l,b,w,h = ax.get_position()
-# for post 0.91, pos = ax.get_position(); l,b,w,h = pos.bounds
-# this works for both.
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h])
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
Modified: trunk/toolkits/basemap/examples/plotmap_oo.py
===================================================================
--- trunk/toolkits/basemap/examples/plotmap_oo.py 2008-01-23 13:20:03 UTC
(rev 4886)
+++ trunk/toolkits/basemap/examples/plotmap_oo.py 2008-01-23 13:33:01 UTC
(rev 4887)
@@ -45,11 +45,8 @@
# plot image over map with imshow.
im = m.imshow(topodat,cm.jet)
# setup colorbar axes instance.
-# for matplotlib 0.91 and earlier, could do l,b,w,h = ax.get_position()
-# for post 0.91, pos = ax.get_position(); l,b,w,h = pos.bounds
-# this works for both.
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = fig.add_axes([l+w+0.075, b, 0.05, h],frameon=False) # setup colorbar axes
fig.colorbar(im, cax=cax) # draw colorbar
# plot blue dot on boulder, colorado and label it as such.
Modified: trunk/toolkits/basemap/examples/plotprecip.py
===================================================================
--- trunk/toolkits/basemap/examples/plotprecip.py 2008-01-23 13:20:03 UTC
(rev 4886)
+++ trunk/toolkits/basemap/examples/plotprecip.py 2008-01-23 13:33:01 UTC
(rev 4887)
@@ -52,7 +52,7 @@
cs = m.contourf(x,y,data,clevs,cmap=cm.s3pcpn)
# new axis for colorbar.
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = pylab.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
# draw colorbar.
pylab.colorbar(cs, cax, format='%g', ticks=clevs, drawedges=False)
@@ -78,7 +78,7 @@
im2.set_cmap(cm.s3pcpn_l)
# new axis for colorbar.
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = pylab.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes
# using im2, not im (hack to prevent colors from being
# too compressed at the low end on the colorbar - results
Modified: trunk/toolkits/basemap/examples/pnganim.py
===================================================================
--- trunk/toolkits/basemap/examples/pnganim.py 2008-01-23 13:20:03 UTC (rev
4886)
+++ trunk/toolkits/basemap/examples/pnganim.py 2008-01-23 13:33:01 UTC (rev
4887)
@@ -99,7 +99,7 @@
# number of repeated frames at beginning and end is n1.
nframe = 0; n1 = 10
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
# loop over times, make contour plots, draw coastlines,
# parallels, meridians and title.
for nt,date in enumerate(datelabels[1:]):
Modified: trunk/toolkits/basemap/examples/simpletest_oo.py
===================================================================
--- trunk/toolkits/basemap/examples/simpletest_oo.py 2008-01-23 13:20:03 UTC
(rev 4886)
+++ trunk/toolkits/basemap/examples/simpletest_oo.py 2008-01-23 13:33:01 UTC
(rev 4887)
@@ -37,11 +37,8 @@
# add a title.
ax.set_title('Robinson Projection')
# add a colorbar.
-# for matplotlib 0.91 and earlier, could do l,b,w,h = ax.get_position()
-# for post 0.91, pos = ax.get_position(); l,b,w,h = pos.bounds
-# this works for both.
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = fig.add_axes([l, b-0.1, w, 0.03],frameon=False) # setup colorbar axes
fig.colorbar(cs, cax=cax, orientation='horizontal',ticks=cs.levels[::3])
# save image (width 800 pixels with dpi=100 and fig width 8 inches).
Modified: trunk/toolkits/basemap/examples/test.py
===================================================================
--- trunk/toolkits/basemap/examples/test.py 2008-01-23 13:20:03 UTC (rev
4886)
+++ trunk/toolkits/basemap/examples/test.py 2008-01-23 13:33:01 UTC (rev
4887)
@@ -30,11 +30,8 @@
# plot image over map.
im = m.imshow(topoin,cm.jet)
# get axes position, add colorbar axes to right of this.
-# for matplotlib 0.91 and earlier, could do l,b,w,h = ax.get_position()
-# for post 0.91, pos = ax.get_position(); l,b,w,h = pos.bounds
-# this works for both.
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -114,7 +111,7 @@
# get current axis instance.
ax = gca()
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -146,7 +143,7 @@
# get current axis instance.
ax = gca()
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -179,7 +176,7 @@
# get current axis instance.
ax = gca()
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -211,7 +208,7 @@
# get current axis instance.
ax = gca()
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -245,7 +242,7 @@
# get current axis instance.
ax = gca()
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -276,7 +273,7 @@
# plot image over map.
im = m.imshow(topodat,cm.jet)
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -309,7 +306,7 @@
# plot image over map.
im = m.imshow(topodat,cm.jet)
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -344,7 +341,7 @@
im = m.imshow(topodat,cm.jet)
im.set_clim(-4000.,3000.) # adjust range of colors.
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -379,7 +376,7 @@
# plot image over map.
im = m.imshow(topodat,cm.jet)
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -410,7 +407,7 @@
# plot image over map.
im = m.imshow(topodat,cm.jet)
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -442,7 +439,7 @@
# plot image over map.
im = m.imshow(topodat,cm.jet)
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -483,7 +480,7 @@
# - see contour_demo.py)
im = m.imshow(topo,palette,norm=colors.normalize(clip=False))
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -524,7 +521,7 @@
# - see contour_demo.py)
im = m.imshow(topo,palette,norm=colors.normalize(clip=False))
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -552,7 +549,7 @@
x,y = m(*meshgrid(lonsin,latsin))
p = m.pcolormesh(x,y,topodatin,shading='flat')
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -579,7 +576,7 @@
x,y = m(*meshgrid(lonsin,latsin))
p = m.pcolormesh(x,y,topodatin,shading='flat')
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
@@ -606,7 +603,7 @@
x,y = m(*meshgrid(lonsin,latsin))
p = m.pcolormesh(x,y,topodatin,shading='flat')
pos = ax.get_position()
-l, b, w, h = getattr(pos, 'bounds', pos)
+l, b, w, h = pos.bounds
cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes.
colorbar(cax=cax) # draw colorbar
axes(ax) # make the original axes current again
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins