Logo Search packages:      
Sourcecode: matplotlib version File versions

pcolor_nonuniform.py

from matplotlib.pyplot import figure, show
import numpy as np
from matplotlib.image import NonUniformImage

x = np.arange(-4, 4, 0.005)
y = np.arange(-4, 4, 0.005)
print 'Size %d points' % (len(x) * len(y))
z = np.sqrt(x[np.newaxis,:]**2 + y[:,np.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()

Generated by  Doxygen 1.6.0   Back to index