Sophie

Sophie

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

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

.. _pylab_examples-image_origin:

pylab_examples example code: image_origin.py
============================================



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

::

    #!/usr/bin/env python
    """
    You can specify whether images should be plotted with the array origin
    x[0,0] in the upper left or upper right by using the origin parameter.
    You can also control the default be setting image.origin in your
    matplotlibrc file; see http://matplotlib.sourceforge.net/matplotlibrc
    """
    from pylab import *
    
    x = arange(100.0); x.shape = 10,10
    
    interp = 'bilinear';
    #interp = 'nearest';
    lim = -2,11,-2,6
    subplot(211, axisbg='g')
    title('blue should be up')
    imshow(x, origin='upper', interpolation=interp)
    #axis(lim)
    
    subplot(212, axisbg='y')
    title('blue should be down')
    imshow(x, origin='lower', interpolation=interp)
    #axis(lim)
    show()
    

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