Skip to content

Pressing the "1" key kills the zoom/pan tool #11432

Closed
@ImportanceOfBeingErnest

Description

Bug report

Bug summary

Pressing the 1 key on the keybord kills the pan/zoom tool.
But only when subplots are used and in case those subplots contain any artist/title etc.

Code for reproduction

Steps for reproduction:

  1. Run the following code with Qt*Agg or TkAgg backend.
import matplotlib.pyplot as plt

fig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2)

# ax2 and ax3 contain some additional elements
ax2.set_title('Ax2')
ax3.plot([1,3,3])

plt.show()
  1. Interact with the zoom and pan tool on all subplots to verify they are working fine.
  2. Press 1 on your keybord while your mouse is over one of the axes.
  3. Try to interact with the zoom / pan tools in that axes again.

Actual outcome

On the two subplots, which do not have anything added (ax1, ax4) zooming and panning still works fine. On the two subplots which either contain a plot element (ax3) or a title (ax2), zooming and panning is broken, i.e. nothing happens if you activate the zoom or the pan tool and drag the mouse over those subplots.

Expected outcome

Obviously one would not want 1 to kill any tools.
Or at least if there is a reason for it, to read about it in the interactive navigation docs.

Further remarks

Interestingly this is limited to the case of multiple subplots. If there is only a single subplot present, pressing 1 is harmless.

This issue was first observed in this SO question for a slightly more involved use case.

Matplotlib version

  • Operating system: Windows 8.1
  • Matplotlib version: tested with 2.0.2, 2.2.2 as well as master
  • Matplotlib backend: Qt4Agg /Qt5Agg /TkAgg
  • Python version: 2.7 / 3.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions