{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n# Multicursor\n\nShowing a cursor on multiple plots simultaneously.\n\nThis example generates three Axes split over two different figures. On\nhovering the cursor over data in one subplot, the values of that datapoint are\nshown in all Axes.\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 MultiCursor\n\nt = np.arange(0.0, 2.0, 0.01)\ns1 = np.sin(2*np.pi*t)\ns2 = np.sin(3*np.pi*t)\ns3 = np.sin(4*np.pi*t)\n\nfig, (ax1, ax2) = plt.subplots(2, sharex=True)\nax1.plot(t, s1)\nax2.plot(t, s2)\nfig, ax3 = plt.subplots()\nax3.plot(t, s3)\n\nmulti = MultiCursor(None, (ax1, ax2, ax3), color='r', lw=1)\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.MultiCursor`\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 }