def __init__(self, fig_manager): """ Registers handlers for events of interest :param fig_manager: A reference to the figure manager containing the canvas that receives the events """ # Check it looks like a FigureCanvasQT if not hasattr(fig_manager.canvas, "buttond"): raise RuntimeError("Figure canvas does not look like a Qt canvas.") canvas = fig_manager.canvas self._cids = [] self._cids.append(canvas.mpl_connect('button_press_event', self.on_mouse_button_press)) self._cids.append(canvas.mpl_connect('button_release_event', self.on_mouse_button_release)) self._cids.append(canvas.mpl_connect('draw_event', self.draw_callback)) self._cids.append(canvas.mpl_connect('motion_notify_event', self.motion_event)) self._cids.append(canvas.mpl_connect('resize_event', self.mpl_redraw_annotations)) self._cids.append(canvas.mpl_connect('figure_leave_event', self.on_leave)) self._cids.append(canvas.mpl_connect('axis_leave_event', self.on_leave)) self._cids.append(canvas.mpl_connect('scroll_event', self.on_scroll)) self.canvas = canvas self.toolbar_manager = ToolbarStateManager(self.canvas.toolbar) self.toolbar_manager.home_button_connect(self.redraw_annotations) self.fit_browser = fig_manager.fit_browser self.errors_manager = FigureErrorsManager(self.canvas) self.markers = [] self.valid_lines = VALID_LINE_STYLE self.valid_colors = VALID_COLORS self.default_marker_name = 'marker'
def __init__(self, fig_manager): """ Registers handlers for events of interest :param fig_manager: A reference to the figure manager containing the canvas that receives the events """ # Check it looks like a FigureCanvasQT if not hasattr(fig_manager.canvas, "buttond"): raise RuntimeError("Figure canvas does not look like a Qt canvas.") canvas = fig_manager.canvas self._cids = [] self._cids.append( canvas.mpl_connect('button_press_event', self.on_mouse_button_press)) self.canvas = canvas self.toolbar_manager = ToolbarStateManager(self.canvas.toolbar) self.fit_browser = fig_manager.fit_browser self.errors_manager = FigureErrorsManager(self.canvas)
def setUp(self): self.fig, self.ax = plt.subplots(subplot_kw={'projection': 'mantid'}) self.errors_manager = FigureErrorsManager(self.fig.canvas)
def setUp(self): self.fig, self.ax = plt.subplots() # type: matplotlib.figure.Figure, MantidAxes self.errors_manager = FigureErrorsManager(self.fig.canvas) # type: FigureErrorsManager