{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Cursor\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import matplotlib.pyplot as plt\nimport numpy as np\n\nfrom matplotlib.widgets import Cursor\n\n# Fixing random state for reproducibility\nnp.random.seed(19680801)\n\nfig, ax = plt.subplots(figsize=(8, 6))\n\nx, y = 4*(np.random.rand(2, 100) - .5)\nax.plot(x, y, 'o')\nax.set_xlim(-2, 2)\nax.set_ylim(-2, 2)\n\n# Set useblit=True on most backends for enhanced performance.\ncursor = Cursor(ax, useblit=True, color='red', linewidth=2)\n\nplt.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ ".. admonition:: References\n\n The use of the following functions, methods, classes and modules is shown\n in this example:\n\n - `matplotlib.widgets.Cursor`\n\n" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.2" } }, "nbformat": 4, "nbformat_minor": 0 }