8000 added binary colormap and barcode demo · matplotlib/matplotlib@4c6b6f5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4c6b6f5

Browse files
committed
added binary colormap and barcode demo
svn path=/trunk/matplotlib/; revision=3019
1 parent 47af03d commit 4c6b6f5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

examples/barcode_demo.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
from pylab import figure, show, cm, nx
22

3+
# the bar
4+
x = nx.mlab.rand(500)
5+
x[x>0.7] = 1.
6+
x[x<=0.7] = 0.
7+
38
axprops = dict(xticks=[], yticks=[])
49
barprops = dict(aspect='auto', cmap=cm.binary, interpolation='nearest')
510

611
fig = figure()
712

813
# a vertical barcode
9-
x = nx.mlab.rand(500,1)
10-
x[x>0.8] = 1.
11-
x[x<=0.8] = 0.
14+
x.shape = len(x), 1
1215
ax = fig.add_axes([0.1, 0.3, 0.1, 0.6], **axprops)
1316
ax.imshow(x, **barprops)
1417

1518

1619
# a horizontal barcode
17-
x = nx.mlab.rand(1,500)
18-
x[x>0.8] = 1.
19-
x[x<=0.8] = 0.
20+
x.shape = 1, len(x)
2021
ax = fig.add_axes([0.3, 0.1, 0.6, 0.1], **axprops)
2122
ax.imshow(x, **barprops)
2223

0 commit comments

Comments
 (0)
0