Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e370858

Browse files
committed
added gradient bar example
svn path=/trunk/matplotlib/; revision=3863
1 parent 55a9261 commit e370858

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

examples/gradient_bar.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from pylab import figure, show, nx, cm
2+
3+
def gbar(ax, x, y, width=0.5, bottom=0):
4+
X = [[.6, .6],[.7,.7]]
5+
for left,top in zip(x, y):
6+
right = left+width
7+
ax.imshow(X, interpolation='bicubic', cmap=cm.Blues,
8+
extent=(left, right, bottom, top), alpha=1)
9+
10+
fig = figure()
11+
12+
xmin, xmax = xlim = 0,10
13+
ymin, ymax = ylim = 0,1
14+
ax = fig.add_subplot(111, xlim=xlim, ylim=ylim,
15+
autoscale_on=False)
16+
X = [[.6, .6],[.7,.7]]
17+
18+
ax.imshow(X, interpolation='bicubic', cmap=cm.copper,
19+
extent=(xmin, xmax, ymin, ymax), alpha=1)
20+
21+
N = 10
22+
x = nx.arange(N)+0.25
23+
y = nx.mlab.rand(N)
24+
gbar(ax, x, y, width=0.7)
25+
ax.set_aspect('normal')
26+
show()

0 commit comments

Comments
 (0)