Revision: 8208
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8208&view=rev
Author:   ryanmay
Date:     2010-03-21 19:27:52 +0000 (Sun, 21 Mar 2010)

Log Message:
-----------
Add second example from scipy cookbook to this script, showing the use of more 
traditional colormapping.

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

Modified: trunk/matplotlib/examples/pylab_examples/multicolored_line.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/multicolored_line.py       
2010-03-21 17:43:11 UTC (rev 8207)
+++ trunk/matplotlib/examples/pylab_examples/multicolored_line.py       
2010-03-21 19:27:52 UTC (rev 8208)
@@ -28,9 +28,26 @@
 lc = LineCollection(segments, cmap=cmap, norm=norm)
 lc.set_array(z)
 lc.set_linewidth(3)
+
+fig1 = plt.figure()
 plt.gca().add_collection(lc)
-
 plt.xlim(x.min(), x.max())
 plt.ylim(-1.1, 1.1)
+
+# Now do a second plot coloring the curve using a continuous colormap
+t = np.linspace(0, 10, 200)
+x = np.cos(np.pi * t)
+y = np.sin(t)
+points = np.array([x, y]).T.reshape(-1, 1, 2)
+segments = np.concatenate([points[:-1], points[1:]], axis=1)
+
+lc = LineCollection(segments, cmap=plt.get_cmap('copper'),
+    norm=plt.Normalize(0, 10))
+lc.set_array(t)
+lc.set_linewidth(3)
+
+fig2 = plt.figure()
+plt.gca().add_collection(lc)
+plt.xlim(-1, 1)
+plt.ylim(-1, 1)
 plt.show()
-


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

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to