Revision: 8279
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8279&view=rev
Author:   efiring
Date:     2010-04-28 06:44:49 +0000 (Wed, 28 Apr 2010)

Log Message:
-----------
contourf_demo: illustrate use of set_under and set_over with contourf colors kw

Modified Paths:
--------------
    trunk/matplotlib/examples/pylab_examples/contourf_demo.py

Modified: trunk/matplotlib/examples/pylab_examples/contourf_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/contourf_demo.py   2010-04-27 
20:30:53 UTC (rev 8278)
+++ trunk/matplotlib/examples/pylab_examples/contourf_demo.py   2010-04-28 
06:44:49 UTC (rev 8279)
@@ -61,10 +61,16 @@
 # Now make a contour plot with the levels specified,
 # and with the colormap generated automatically from a list
 # of colors.
-levels = [-2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5]
+levels = [-1.5, -1, -0.5, 0, 0.5, 1]
 CS3 = contourf(X, Y, Z, levels,
                         colors = ('r', 'g', 'b'),
-                        origin=origin)
+                        origin=origin,
+                        extend='both')
+# Our data range extends outside the range of levels; make
+# data below the lowest contour level yellow, and above the
+# highest level cyan:
+CS3.cmap.set_under('yellow')
+CS3.cmap.set_over('cyan')
 
 CS4 = contour(X, Y, Z, levels,
                        colors = ('k',),
@@ -72,6 +78,9 @@
                        origin = origin)
 title('Listed colors (3 masked regions)')
 clabel(CS4, fmt = '%2.1f', colors = 'w', fontsize=14)
+
+# Notice that the colorbar command gets all the information it
+# needs from the ContourSet object, CS3.
 colorbar(CS3)
 
 show()


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to