.. _pylab_examples-image_origin:

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



.. plot:: /build/matplotlib-Gi1JJZ/matplotlib-1.5.1/doc/mpl_examples/pylab_examples/image_origin.py

::

    """
    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.org/matplotlibrc
    """
    import matplotlib.pyplot as plt
    import numpy as np
    
    x = np.arange(100.0)
    x.shape = (10, 10)
    
    interp = 'bilinear'
    #interp = 'nearest'
    lim = -2, 11, -2, 6
    plt.subplot(211, axisbg='g')
    plt.title('blue should be up')
    plt.imshow(x, origin='upper', interpolation=interp, cmap='jet')
    #plt.axis(lim)
    
    plt.subplot(212, axisbg='y')
    plt.title('blue should be down')
    plt.imshow(x, origin='lower', interpolation=interp, cmap='jet')
    #plt.axis(lim)
    plt.show()
    

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