Skip to content

Commit

Permalink
check for legend existing before use
Browse files Browse the repository at this point in the history
  • Loading branch information
jhaigh0 committed Sep 18, 2024
1 parent 2722e15 commit de456bc
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _get_next_axis_scale(self, current_scale):
def _correct_for_scroll_event_on_legend(self, event):
# Corrects default behaviour in Matplotlib where legend is picked up by scroll event
legend = event.inaxes.axes.get_legend()
if legend.get_draggable() and legend.contains(event):
if legend is not None and legend.get_draggable() and legend.contains(event):
legend_set_draggable(legend, False)
legend_set_draggable(legend, True)

Expand Down

0 comments on commit de456bc

Please sign in to comment.