Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > a44f8c7e78ee9c5838c1fb080c9e7630 > files > 1385

python-matplotlib-doc-1.1.1-1mdv2010.1.noarch.rpm

.. _pylab_examples-pcolor_demo:

pylab_examples example code: pcolor_demo.py
===========================================



.. plot:: /home/mandrake/rpm/BUILD/matplotlib-1.1.1/doc/mpl_examples/pylab_examples/pcolor_demo.py

::

    #!/usr/bin/env python
    """
    See pcolor_demo2 for an alternative way of generating pcolor plots
    using imshow that is likely faster for large grids
    """
    from __future__ import division
    from matplotlib.patches import Patch
    from pylab import *
    
    def func3(x,y):
        return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)
    
    
    # make these smaller to increase the resolution
    dx, dy = 0.05, 0.05
    
    x = arange(-3.0, 3.0001, dx)
    y = arange(-3.0, 3.0001, dy)
    X,Y = meshgrid(x, y)
    
    Z = func3(X, Y)
    pcolor(X, Y, Z)
    colorbar()
    axis([-3,3,-3,3])
    
    show()
    
    
    

Keywords: python, matplotlib, pylab, example, codex (see :ref:`how-to-search-examples`)