Revision: 3863
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3863&view=rev
Author: jdh2358
Date: 2007-09-20 06:50:27 -0700 (Thu, 20 Sep 2007)
Log Message:
-----------
added gradient bar example
Added Paths:
-----------
trunk/matplotlib/examples/gradient_bar.py
Added: trunk/matplotlib/examples/gradient_bar.py
===================================================================
--- trunk/matplotlib/examples/gradient_bar.py (rev 0)
+++ trunk/matplotlib/examples/gradient_bar.py 2007-09-20 13:50:27 UTC (rev 3863)
@@ -0,0 +1,26 @@
+from pylab import figure, show, nx, cm
+
+def gbar(ax, x, y, width=0.5, bottom=0):
+ X = [[.6, .6],[.7,.7]]
+ for left,top in zip(x, y):
+ right = left+width
+ ax.imshow(X, interpolation='bicubic', cmap=cm.Blues,
+ extent=(left, right, bottom, top), alpha=1)
+
+fig = figure()
+
+xmin, xmax = xlim = 0,10
+ymin, ymax = ylim = 0,1
+ax = fig.add_subplot(111, xlim=xlim, ylim=ylim,
+ autoscale_on=False)
+X = [[.6, .6],[.7,.7]]
+
+ax.imshow(X, interpolation='bicubic', cmap=cm.copper,
+ extent=(xmin, xmax, ymin, ymax), alpha=1)
+
+N = 10
+x = nx.arange(N)+0.25
+y = nx.mlab.rand(N)
+gbar(ax, x, y, width=0.7)
+ax.set_aspect('normal')
+show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|