Sophie

Sophie

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

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

.. _pylab_examples-legend_scatter:

pylab_examples example code: legend_scatter.py
==============================================



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

::

    #!/usr/bin/env python
    from pylab import *
    
    N=1000
    
    props = dict( alpha=0.5, edgecolors='none' )
    
    handles = []
    colours = ['red', 'green', 'blue', 'magenta', 'cyan', 'yellow']
    colours = ['red', 'green', 'blue']
    for colour in colours:
        x, y = rand(2,N)
        s = 400.0 * rand(N)
        handles.append(scatter(x, y, c=colour, s=s, **props))
    
    legend(handles, colours)
    grid(True)
    
    show()
    
    
    

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