Sophie

Sophie

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

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

.. _api-clippath_demo:

api example code: clippath_demo.py
==================================



.. plot:: /home/mandrake/rpm/BUILD/matplotlib-1.1.1/doc/mpl_examples/api/clippath_demo.py

::

    """
    Clipping to arbitrary patches and paths
    """
    import numpy as np
    import matplotlib.pyplot as plt
    import matplotlib.path as path
    import matplotlib.patches as patches
    
    
    fig = plt.figure()
    ax = fig.add_subplot(111, frameon=False, xticks=[], yticks=[])
    
    im = ax.imshow(np.random.rand(10,10))
    
    patch = patches.Circle((300,300), radius=100)
    im.set_clip_path(patch)
    
    plt.show()
    
    
    

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