Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pixel picking for multiple displays in same figure #2358

Merged
merged 1 commit into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions ctapipe/visualization/mpl_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,11 @@ def clear_overlays(self):

def _on_pick(self, event):
"""handler for when a pixel is clicked"""
if event.artist is not self.pixels:
# do nothing if the event was triggered by something
# other than this displays pixels artist
return

pix_id = event.ind[-1]
x = self.geom.pix_x[pix_id].to_value(self.unit)
y = self.geom.pix_y[pix_id].to_value(self.unit)
Expand Down
2 changes: 2 additions & 0 deletions docs/changes/2358.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix that the pixel picker of the matplotlib ``CameraDisplay`` triggers
also for clicks on other ``CameraDisplay`` instances in the same figure.