def leftButtonUp(self, evt, x, y): """ Completely overrides base class functionality. """ if self.leftButtonPoint is None: return view = self.getView() if self.selectedAxes is None: axes, xdata, ydata = self.find_axes(view, x, y) else: axes = self.selectedAxes xdata, ydata = get_data(axes, x, y) self.setActiveSubplot(axes) self.end_x = x self.end_y = y if self.IsInfoMode() and axes is not None: self.SelectAxes(axes) x0, y0 = self.leftButtonPoint self.leftButtonPoint = None view.rubberband.clear() if x0 == x: if y0 == y and axes is not None: view.notify_point(axes, x, y) view.crosshairs.set(x, y) return elif y0 == y: return xdata = ydata = None xrange, yrange = get_selected_data(axes, x0, y0, x, y) if axes is not None: xdata, ydata = axes.transData.inverse_xy_tup((x, y)) if self.zoomEnabled: for ax in self.find_all_axes(view, x, y): xrange, yrange = get_selected_data(ax, x0, y0, x, y) if xrange is not None and yrange is not None: if self.limits.set(ax, xrange, yrange): FigureCanvasWxAgg.draw(view) else: self.getView().notify_selection(axes, x0, y0, x, y) if axes is None: view.cursor.setNormal() elif wxmpl.is_polar(axes): view.cursor.setNormal() view.location.set(wxmpl.format_coord(axes, xdata, ydata)) else: view.crosshairs.set(x, y) view.location.set(wxmpl.format_coord(axes, xdata, ydata)) if len(self.find_all_axes(self.view, x, y)) > 1: self.UpdateLocationStr(x, y)
def leftButtonUp(self, evt, x, y): """ Completely overrides base class functionality. """ if self.leftButtonPoint is None: return view = self.getView() if self.selectedAxes is None: axes, xdata, ydata = self.find_axes(view, x, y) else: axes = self.selectedAxes xdata, ydata = get_data(axes, x, y) self.setActiveSubplot(axes) self.end_x = x self.end_y = y if self.IsInfoMode() and axes is not None: self.SelectAxes(axes) x0, y0 = self.leftButtonPoint self.leftButtonPoint = None view.rubberband.clear() if x0 == x: if y0 == y and axes is not None: view.notify_point(axes, x, y) view.crosshairs.set(x, y) return elif y0 == y: return xdata = ydata = None xrange, yrange = get_selected_data(axes, x0, y0, x, y) if axes is not None: xdata, ydata = axes.transData.inverted().transform((x, y)) if self.zoomEnabled: for ax in self.find_all_axes(view, x, y): xrange, yrange = get_selected_data(ax, x0, y0, x, y) if xrange is not None and yrange is not None: if self.limits.set(ax, xrange, yrange): FigureCanvasWxAgg.draw(view) else: self.getView().notify_selection(axes, x0, y0, x, y) if axes is None: view.cursor.setNormal() elif self.is_polar(axes): view.cursor.setNormal() view.location.set(wxmpl.format_coord(axes, xdata, ydata)) else: view.crosshairs.set(x, y) view.location.set(wxmpl.format_coord(axes, xdata, ydata)) if len(self.find_all_axes(self.view, x, y)) > 1: self.UpdateLocationStr(x, y)
def axesMouseMotion(self, evt, x, y, axes, xdata, ydata): """ Overriding wxmpl event handler to do my stuff™ """ xdata = int(floor(xdata + 0.5)) ydata = int(floor(ydata + 0.5)) # The original stuff. We'll leave this for now. view = self.panelRatios.director.view view.cursor.setCross() view.crosshairs.set(x, y) # Added: the replot of the details on mouse movement self.mainFrame.x, self.mainFrame.y = xdata, ydata self.mainFrame.ReplotDetails() # Update colorbar self.panelRatios.restore_region(self.bg_cb) axis = self.cb.ax.get_yaxis() value = self.data[ydata,xdata] self.cb.set_ticks([value]) axis.set_tick_params(direction='in', length=8, width=3, colors='black') axis.set_animated(True) self.cb.ax.draw_artist(axis) self.panelRatios.blit(self.cb.ax.bbox) # Changed: we round the coordinates view.location.set(wxmpl.format_coord(axes, xdata, ydata)) self.mainFrame.update_stats()