From: John H. <jdh...@ac...> - 2005-12-03 13:20:04
|
>>>>> "Christian" == Christian Kristukat <ck...@ho...> writes: Christian> Hi, interpolation seems not to be supported for pcolor Christian> plots. Is that true? I want to plot nonaequidistant Christian> gridded data, so imshow is not the right choice. Using Christian> contourf with a large number of contour levels works Christian> fine but the eps output is huge. I'd prefer to have the Christian> image embedded as bitmap in an eps, that's why I'd like Christian> to use pcolor. Regards, Christian Nicholas Young contributed a patch which supports a NonUniformImage Make sure you have the most recent CVS, eg Checking in lib/matplotlib/image.py; /cvsroot/matplotlib/matplotlib/lib/matplotlib/image.py,v <-- image.py new revision: 1.25; previous revision: 1.24 done or later Below is an example. from pylab import figure, show import matplotlib.numerix as nx from matplotlib.image import NonUniformImage x = nx.arange(-4, 4, 0.005) y = nx.arange(-4, 4, 0.005) print 'Size %d points' % (len(x) * len(y)) z = nx.sqrt(x[nx.NewAxis,:]**2 + y[:,nx.NewAxis]**2) fig = figure() ax = fig.add_subplot(111) im = NonUniformImage(ax, extent=(-4,4,-4,4)) im.set_data(x, y, z) ax.images.append(im) ax.set_xlim(-4,4) ax.set_ylim(-4,4) fig2 = figure() ax = fig2.add_subplot(111) x2 = x**3 im = NonUniformImage(ax, extent=(-64,64,-4,4)) im.set_data(x2, y, z) ax.images.append(im) ax.set_xlim(-64,64) ax.set_ylim(-4,4) show() |