File: keyboard_shortcuts.py

package info (click to toggle)
mplcursors 0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 400 kB
  • sloc: python: 1,915; makefile: 14; sh: 9
file content (19 lines) | stat: -rw-r--r-- 488 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""
Keyboard shortcuts
==================

By default, mplcursors uses "t" to toggle interactivity and "d" to hide/show
annotation boxes.  These shortcuts can be customized.
"""

import matplotlib.pyplot as plt
import mplcursors

fig, ax = plt.subplots()
ax.plot(range(10), "o-")
ax.set_title('Press "e" to enable/disable the datacursor\n'
             'Press "h" to hide/show any annotation boxes')

mplcursors.cursor(bindings={"toggle_visible": "h", "toggle_enabled": "e"})

plt.show()