### Navigation

- index
- modules |
- home|
- examples|
- tutorials|
- pyplot|
- docs »

# Cursor

    from matplotlib.widgets import Cursor
    import numpy as np
    import matplotlib.pyplot as plt

    # Fixing random state for reproducibility
    np.random.seed(19680801)

    fig = plt.figure(figsize=(8, 6))
    ax = fig.add_subplot(111, facecolor='#FFFFCC')

    x, y = 4*(np.random.rand(2, 100) - .5)
    ax.plot(x, y, 'o')
    ax.set_xlim(-2, 2)
    ax.set_ylim(-2, 2)

    # set useblit = True on gtkagg for enhanced performance
    cursor = Cursor(ax, useblit=True, color='red', linewidth=2)

    plt.show()

Total running time of the script: ( 0 minutes 0.024 seconds)

Generated by Sphinx-Gallery