Sophie

Sophie

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

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

.. _widgets-multicursor:

widgets example code: multicursor.py
====================================

[`source code <multicursor.py>`_]

::

    from matplotlib.widgets import MultiCursor
    from pylab import figure, show, pi, arange, sin
    
    t = arange(0.0, 2.0, 0.01)
    s1 = sin(2*pi*t)
    s2 = sin(4*pi*t)
    fig = figure()
    ax1 = fig.add_subplot(211)
    ax1.plot(t, s1)
    
    
    ax2 = fig.add_subplot(212, sharex=ax1)
    ax2.plot(t, s2)
    
    multi = MultiCursor(fig.canvas, (ax1, ax2), color='r', lw=1)
    show()
    

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