'''
Quick illustration of axes.pcolorfast
'''

from matplotlib.pyplot import figure, show
import numpy as npy
import matplotlib.numerix.npyma as ma
from matplotlib.image import PcolorImage
from matplotlib import cm

x = npy.arange(0, 4.0, 0.005, dtype=float)
y = npy.arange(0, 5.0, 0.005, dtype=float)
print 'Size %d points' % (len(x) * len(y))
z = npy.sqrt(x[npy.newaxis,:-1]**2 + y[:-1,npy.newaxis]**2)

z = ma.masked_where(z < 1, z)

X, Y = npy.meshgrid(x,y)

print z.shape

fig = figure()
ax = fig.add_subplot(111)
im = ax.pcolorfast(z)
fig.colorbar(im)
ax.set_title('Image')

if 1:
    fig2 = figure()
    ax = fig2.add_subplot(111)
    im = ax.pcolorfast(x*x, y, z)
    fig2.colorbar(im)
    im.set_cmap(cm.cool)
    ax.set_title('Non-uniform image')
if 1:
    fig3 = figure()
    ax = fig3.add_subplot(111)
    im = ax.pcolorfast(X*npy.sqrt(Y), Y*Y, z)
    fig3.colorbar(im)
    im.set_cmap(cm.hot)
    ax.set_title('QuadMesh')

show()
