Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b67be9a

Browse files
committed
applied Pauls keybinding patch
svn path=/trunk/matplotlib/; revision=6291
1 parent 362d5f5 commit b67be9a

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

doc/users/navigation_toolbar.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,30 @@ The ``Save`` button
7676
``svg`` and ``pdf``.
7777

7878

79+
Navigation Keyboard Shortcuts
80+
-----------------------------
81+
82+
================================== =====================
83+
Command Keyboard Shortcut(s)
84+
================================== =====================
85+
Home/Reset **h** or **r** or **home**
86+
Back **c** or **left arrow** or **backspace**
87+
Forward **v** or **right arrow**
88+
Pan/Zoom **p**
89+
Zoom-to-rect **o**
90+
Save **s**
91+
Toggle fullscreen **f**
92+
---------------------------------- ---------------------
93+
**Pan/Zoom mode only**
94+
- constrain pan/zoom to x axis hold **x**
95+
- constrain pan/zoom to y axis hold **y**
96+
- preserve aspect ratio hold **CONTROL**
97+
---------------------------------- ---------------------
98+
**In axes only**
99+
- Toggle grid **g**
100+
- Toggle y axis scale (log/linear) **l**
101+
================================== =====================
102+
79103
If you are using :mod:`matplotlib.pyplot` the toolbar will be created
80104
automatically for every figure. If you are writing your own user
81105
interface code, you can add the toolbar as a widget. The exact syntax

lib/matplotlib/backend_bases.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,6 +1513,23 @@ def key_press(self, event):
15131513

15141514
if event.key == 'f':
15151515
self.full_screen_toggle()
1516+
1517+
# *h*ome or *r*eset mnemonic
1518+
elif event.key == 'h' or event.key == 'r' or event.key == "home":
1519+
self.canvas.toolbar.home()
1520+
# c and v to enable left handed quick navigation
1521+
elif event.key == 'left' or event.key == 'c' or event.key == 'backspace':
1522+
self.canvas.toolbar.back()
1523+
elif event.key == 'right' or event.key == 'v':
1524+
self.canvas.toolbar.forward()
1525+
# *p*an mnemonic
1526+
elif event.key == 'p':
1527+
self.canvas.toolbar.pan()
1528+
# z*o*om mnemonic
1529+
elif event.key == 'o':
1530+
self.canvas.toolbar.zoom()
1531+
elif event.key == 's':
1532+
self.canvas.toolbar.save_figure(self.canvas.toolbar)
15161533

15171534
if event.inaxes is None:
15181535
return

0 commit comments

Comments
 (0)