On 2/13/07, John Hunter <[EMAIL PROTECTED]> wrote: > Something like the following should do the trick:
A minor modification: for a barcode, you'll want to pass interpolation='nearest' to the imshow command. I just committed the binary colormap to svn and added examples/barcode_demo.py. The new version below puts it all together (but requires svn): from pylab import figure, show, cm, nx axprops = dict(xticks=[], yticks=[]) barprops = dict(aspect='auto', cmap=cm.binary, interpolation='nearest') fig = figure() # a vertical barcode x = nx.mlab.rand(500,1) x[x>0.8] = 1. x[x<=0.8] = 0. ax = fig.add_axes([0.1, 0.3, 0.1, 0.6], **axprops) ax.imshow(x, **barprops) # a horizontal barcode x = nx.mlab.rand(1,500) x[x>0.8] = 1. x[x<=0.8] = 0. ax = fig.add_axes([0.3, 0.1, 0.6, 0.1], **axprops) ax.imshow(x, **barprops) fig.savefig('barcode.png', dpi=100) show() ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users