.. _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`)