Closed
Description
Request an inaxes method in Figure to calculate whether a point is in an axes and return the axes. i.e.
def inaxes(self, xy):
axes_list = [a for a in self.get_axes() if a.patch.contains_point(xy)]
if len(axes_list) == 0:
axes = None
elif len(axes_list) > 1: # Overlap, get the highest zorder
axes_list.sort(key=lambda x: x.zorder)
axes = axes_list[-1] # Use the highest zorder
else:
axes = axes_list[0]
return axes
Rational: This make it easier (in my opinion) to find a method that do the requested method. Alternative is to create a LocationEvent and use the inaxes attribute. Using the LocationEvent class may trigger axes_enter_event and axes_leave_event.
In any cases a good documentation on matplotlib's coordinate and how to convert different backends' coordinate to matplotlib, most of the time flip the y axis, is needed.
Metadata
Metadata
Assignees
Labels
No labels