Revision: 7412
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7412&view=rev
Author: jswhit
Date: 2009-08-07 00:38:17 +0000 (Fri, 07 Aug 2009)
Log Message:
-----------
make sure contour lines and filled contour intervals are consistent
Modified Paths:
--------------
trunk/toolkits/basemap/examples/contour_demo.py
Modified: trunk/toolkits/basemap/examples/contour_demo.py
===================================================================
--- trunk/toolkits/basemap/examples/contour_demo.py 2009-08-06 20:27:58 UTC
(rev 7411)
+++ trunk/toolkits/basemap/examples/contour_demo.py 2009-08-07 00:38:17 UTC
(rev 7412)
@@ -19,13 +19,15 @@
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# make a filled contour plot.
x, y = m(lons, lats)
-CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
-CS = m.contourf(x,y,hgt,15,cmap=plt.cm.jet)
+# create contour lines
+CS1 = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
+# fill between contour lines.
+CS2 = m.contourf(x,y,hgt,CS1.levels,cmap=plt.cm.jet)
# setup colorbar axes instance.
pos = ax.get_position()
l, b, w, h = pos.bounds
cax = plt.axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes
-plt.colorbar(drawedges=True, cax=cax) # draw colorbar
+plt.colorbar(CS2, drawedges=True, cax=cax) # draw colorbar
plt.axes(ax) # make the original axes current again
# draw coastlines and political boundaries.
m.drawcoastlines()
@@ -46,12 +48,12 @@
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# make a filled contour plot.
x, y = m(lons, lats)
-CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
-CS = m.contourf(x,y,hgt,15,cmap=plt.cm.jet)
+CS1 = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
+CS2 = m.contourf(x,y,hgt,CS1.levels,cmap=plt.cm.jet)
pos = ax.get_position()
l, b, w, h = pos.bounds
cax = plt.axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes
-plt.colorbar(drawedges=True, cax=cax) # draw colorbar
+plt.colorbar(CS2, drawedges=True, cax=cax) # draw colorbar
plt.axes(ax) # make the original axes current again
# draw coastlines and political boundaries.
m.drawcoastlines()
@@ -72,12 +74,12 @@
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# make a filled contour plot.
x, y = m(lons, lats)
-CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
-CS = m.contourf(x,y,hgt,15,cmap=plt.cm.jet)
+CS1 = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
+CS2 = m.contourf(x,y,hgt,CS1.levels,cmap=plt.cm.jet)
pos = ax.get_position()
l, b, w, h = pos.bounds
cax = plt.axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes
-plt.colorbar(drawedges=True, cax=cax) # draw colorbar
+plt.colorbar(CS2, drawedges=True, cax=cax) # draw colorbar
plt.axes(ax) # make the original axes current again
# draw coastlines and political boundaries.
m.drawcoastlines()
@@ -98,12 +100,12 @@
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# make a filled contour plot.
x, y = m(lons, lats)
-CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
-CS = m.contourf(x,y,hgt,15,cmap=plt.cm.jet)
+CS1 = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
+CS2 = m.contourf(x,y,hgt,CS2.levels,cmap=plt.cm.jet)
pos = ax.get_position()
l, b, w, h = pos.bounds
cax = plt.axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes
-plt.colorbar(drawedges=True, cax=cax) # draw colorbar
+plt.colorbar(CS2, drawedges=True, cax=cax) # draw colorbar
plt.axes(ax) # make the original axes current again
# draw coastlines and political boundaries.
m.drawcoastlines()
@@ -125,12 +127,12 @@
ax = fig.add_axes([0.1,0.1,0.7,0.7])
# make a filled contour plot.
x, y = m(lons, lats)
-CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
-CS = m.contourf(x,y,hgt,15,cmap=plt.cm.jet)
+CS1 = m.contour(x,y,hgt,15,linewidths=0.5,colors='k')
+CS2 = m.contourf(x,y,hgt,CS2.levels,cmap=plt.cm.jet)
pos = ax.get_position()
l, b, w, h = pos.bounds
cax = plt.axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes
-plt.colorbar(drawedges=True, cax=cax) # draw colorbar
+plt.colorbar(CS2, drawedges=True, cax=cax) # draw colorbar
plt.axes(ax) # make the original axes current again
# draw coastlines and political boundaries.
m.drawcoastlines()
@@ -144,4 +146,3 @@
plt.title('Orthographic Filled Contour Demo')
print 'plotting with orthographic basemap ..'
plt.show()
-
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins