So I have three matplotlib subplots. I can use a pick event to pull off and re-plot the data in any one of the subplot. Is it possible to read the pick event and to find out what subplot number was selected?
self.figure_canvas.mpl_connect('pick_event', self.select_axes) def select_axes(self, event): if event.mouseevent.button == 1: if isinstance(event.artist, matplotlib.axes.Axes): axes = event.artist for line in axes.get_lines(): plt.figure() plt.plot(line.get_xdata(), line.get_ydata()) plt.show() I cant seem to format this code correctly, basically I can pull off the plotted data but I cant tell which subplot it came from.
You have the Axes object so you can probably do what ever you want with it. Failing that, you can use Axes as keys in dictionaries to map back to what ever you want.
Axesobject so you can probably do what ever you want with it. Failing that, you can useAxesas keys in dictionaries to map back to what ever you want.