Skip to content

MultiCursor bug #20231

Closed
Closed

Description

@fedbont94

Bug report

Bug summary

When plotting multiple subplots, the cursor it is correctly shown only in the one given. However, it moves regardless of which subplot the mouse is on. In my opinion, this should not be the case.
I was not able to find a solution to this problem myself.

Code for reproduction

import matplotlib.pyplot as plt
from matplotlib.widgets import MultiCursor

fig = plt.figure(figsize=(18, 12), constrained_layout=True)
gs = fig.add_gridspec(8, 10)

# Let us show 4 subplots:
ax0 = fig.add_subplot(gs[:4, :5])
ax1 = fig.add_subplot(gs[4:, :5])
ax2 = fig.add_subplot(gs[:4, 5:])
ax3 = fig.add_subplot(gs[4:, 5:])

# Shows a cursor for 2 subplots but it moves regardless of which subplot the mouse is on.
multi = MultiCursor(fig.canvas, (ax0, ax1), color='r', lw=1, horizOn=False, vertOn=True)

plt.show()

Actual outcome
Cursor moves regardless of the subplot

Expected outcome
It should move only when the mouse is on the given subplots

Matplotlib version

  • Operating system: Ubuntu 20
  • Matplotlib version (3.3.4):
  • Matplotlib backend (Qt5Agg):
  • Python version: Python 3.8.6
  • Jupyter version (if applicable): None
  • Other libraries: None
pip None

Activity

  1. ianhi commented on May 14, 2021

    @ianhi
    Contributor

    Hi @fedbont94 good catch - happily this has been fixed already! See #19635 and #19636. Although I'm not sure which version it will be released in?

    So I'll close but feel free to re-open if you think this should be kept open.

  2. ianhi commented on May 14, 2021

    @ianhi
    Contributor

    Update: It will be released in in 3.4.3 see #20232

  3. added this to the v3.4.3 milestone on May 14, 2021
  4. fedbont94 commented on May 14, 2021

    @fedbont94
    Author

    Thanks for the help guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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