Sophie

Sophie

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

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

.. _pylab_examples-log_bar:

pylab_examples example code: log_bar.py
=======================================



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

::

    #!/usr/bin/env python
    
    from matplotlib import pylab
    
    data = ((3,1000), (10,3), (100,30), (500, 800), (50,1))
    
    pylab.xlabel("FOO")
    pylab.ylabel("FOO")
    pylab.title("Testing")
    pylab.gca().set_yscale('log')
    
    dim = len(data[0])
    w = 0.75
    dimw = w / dim
    
    x = pylab.arange(len(data))
    for i in range(len(data[0])) :
        y = [d[i] for d in data]
        b = pylab.bar(x + i * dimw, y, dimw, bottom=0.001)
    pylab.gca().set_xticks(x + w / 2)
    pylab.gca().set_ylim( (0.001,1000))
    
    pylab.show()
    
    
    

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