import optparse
import sys
+import matplotlib
+import matplotlib.image
import numpy
# Depending on your Matplotlib configuration, you may need to adjust
# your backend. Do this before importing pylab or matplotlib.backends.
-#import matplotlib
#matplotlib.use('Agg') # select backend that doesn't require X Windows
#matplotlib.use('GTKAgg') # select backend that supports pylab.show()
X,Y = pylab.meshgrid(Xs, Ys)
return (X,Y,Z)
-def plot(X, Y, Z, full=False, title=None, contours=None, cmap=None):
+def plot(X, Y, Z, full=False, title=None, contours=None, interpolation=None,
+ cmap=None):
"""Plot Z over the mesh X, Y.
>>> X, Y = pylab.meshgrid(range(6), range(2))
# pcolor() is much slower than imshow.
#plot = axes.pcolor(X, Y, Z, cmap=cmap, edgecolors='none')
#axes.autoscale_view(tight=True)
- plot = axes.imshow(Z, aspect='auto', interpolation='bilinear',
+ plot = axes.imshow(Z, aspect='auto', interpolation=interpolation,
origin='lower', cmap=cmap,
extent=(X_min, X_max, Y_min, Y_max))
if not full:
help='Title (%default)')
p.add_option('--test', dest='test', action='store_true',
help='Run internal tests and exit.')
+ interpolations = sorted(matplotlib.image.AxesImage._interpd.keys())
+ p.add_option('--interpolation', dest='interpolation', default='nearest',
+ help=('Interpolation scheme (for false color images) from %s '
+ '(%%default)') % ', '.join(interpolations))
maps=[m for m in pylab.cm.datad if not m.endswith("_r")]
maps.sort()
p.add_option('-m', '--color-map', dest='cmap', default='jet',
print 'Z range: ', Z_min, Z_max
fig = plot(X, Y, Z, full=options.full, title=options.title,
- contours=options.contours, cmap=cmap)
+ contours=options.contours, interpolation=options.interpolation,
+ cmap=cmap)
if options.output:
fig.savefig(options.output)