Sophie

Sophie

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

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

.. _pylab_examples-polar_bar:

pylab_examples example code: polar_bar.py
=========================================



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

::

    #!/usr/bin/env python
    
    import numpy as np
    import matplotlib.cm as cm
    from matplotlib.pyplot import figure, show, rc
    
    
    # force square figure and square axes looks better for polar, IMO
    fig = figure(figsize=(8,8))
    ax = fig.add_axes([0.1, 0.1, 0.8, 0.8], polar=True)
    
    N = 20
    theta = np.arange(0.0, 2*np.pi, 2*np.pi/N)
    radii = 10*np.random.rand(N)
    width = np.pi/4*np.random.rand(N)
    bars = ax.bar(theta, radii, width=width, bottom=0.0)
    for r,bar in zip(radii, bars):
        bar.set_facecolor( cm.jet(r/10.))
        bar.set_alpha(0.5)
    
    show()
    

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