def build_items(): x = np.linspace(-10, 10, 200) y = np.sin(np.sin(np.sin(x))) filename = osp.join(osp.dirname(__file__), "brain.png") items = [ make.curve(x, y, color="b"), make.image(filename=filename), make.trimage(filename=filename), make.maskedimage(filename=filename, colormap='gray', show_mask=True, xdata=[0, 40], ydata=[0, 50]), make.label("Relative position <b>outside</b>", (x[0], y[0]), (-10, -10), "BR"), make.label("Relative position <i>inside</i>", (x[0], y[0]), (10, 10), "TL"), make.label("Absolute position", "R", (0, 0), "R"), make.legend("TR"), make.rectangle(-3, -0.8, -0.5, -1., "rc1"), make.segment(-3, -0.8, -0.5, -1., "se1"), make.ellipse(-10, 0.0, 0, 0, "el1"), make.annotated_rectangle(0.5, 0.8, 3, 1., "rc1", "tutu"), make.annotated_segment(-1, -1, 1, 1., "rc1", "tutu"), Axes( (0, 0), (1, 0), (0, 1) ), PolygonShape(np.array([[150., 330.], [270., 520.], [470., 480.], [520., 360.], [460., 200.], [250., 240.]])), ] return items
def build_items(): x = np.linspace(-10, 10, 200) y = np.sin(np.sin(np.sin(x))) filename = osp.join(osp.dirname(__file__), "brain.png") items = [ make.curve(x, y, color="b"), make.image(filename=filename), make.trimage(filename=filename), make.maskedimage(filename=filename, colormap='gray', show_mask=True, xdata=[0, 40], ydata=[0, 50]), make.label("Relative position <b>outside</b>", (x[0], y[0]), (-10, -10), "BR"), make.label("Relative position <i>inside</i>", (x[0], y[0]), (10, 10), "TL"), make.label("Absolute position", "R", (0, 0), "R"), make.legend("TR"), make.rectangle(-3, -0.8, -0.5, -1., "rc1"), make.segment(-3, -0.8, -0.5, -1., "se1"), make.ellipse(-10, 0.0, 0, 0, "el1"), make.annotated_rectangle(0.5, 0.8, 3, 1., "rc1", "tutu"), make.annotated_segment(-1, -1, 1, 1., "rc1", "tutu"), Axes((0, 0), (1, 0), (0, 1)), PolygonShape( np.array([[150., 330.], [270., 520.], [470., 480.], [520., 360.], [460., 200.], [250., 240.]])), ] return items
def __init__(self, c_callback=None, image_plot=None): super(MzPlotter, self).__init__("m/z", "I") self.c_callback = c_callback widget = self.widget # inject mofified behaviour of wigets plot attribute: widget.plot.__class__ = MzPlot widget.plot.register_c_callback(self.handle_c_pressed) widget.plot.image_plot = image_plot self.setHalfWindowWidth(0.05) self.centralMz = None # todo: refactor as helper a = QwtScaleDraw() label = lambda self, x: QwtText("%s" % x) a.label = new.instancemethod(label, widget.plot, QwtScaleDraw) widget.plot.setAxisScaleDraw(widget.plot.xBottom, a) self.pm = PlotManager(widget) self.pm.add_plot(widget.plot) self.curve = make.curve([], [], color='b', curvestyle="Sticks") # inject modified behaviour: self.curve.__class__ = ModifiedCurveItem self.widget.plot.add_item(self.curve) t = self.pm.add_tool(MzSelectionTool) self.pm.set_default_tool(t) t.activate() marker = Marker(label_cb=widget.plot.label_info, constraint_cb=widget.plot.on_plot) marker.attach(self.widget.plot) line = make.segment(0, 0, 0, 0) line.__class__ = ModifiedSegment line.setVisible(0) setupCommonStyle(line, marker) label = make.info_label("TR", [MzCursorInfo(marker, line)], title=None) label.labelparam.label = "" self.marker = marker self.label = label self.line = line
def __init__(self, c_callback=None): super(MzPlotter, self).__init__("m/z", "I") self.c_callback = c_callback widget = self.widget # inject mofified behaviour of wigets plot attribute: widget.plot.__class__ = MzPlot widget.plot.register_c_callback(self.handle_c_pressed) self.setHalfWindowWidth(0.05) self.centralMz = None # todo: refactor as helper a = QwtScaleDraw() label = lambda self, x : QwtText("%s" % x) a.label = new.instancemethod(label, widget.plot, QwtScaleDraw) widget.plot.setAxisScaleDraw(widget.plot.xBottom, a) self.pm = PlotManager(widget) self.pm.add_plot(widget.plot) self.curve = make.curve([], [], color='b', curvestyle="Sticks") # inject modified behaviour: self.curve.__class__ = ModifiedCurveItem self.widget.plot.add_item(self.curve) t = self.pm.add_tool(MzSelectionTool) self.pm.set_default_tool(t) t.activate() marker = Marker(label_cb=widget.plot.label_info,\ constraint_cb=widget.plot.on_plot) marker.attach(self.widget.plot) line = make.segment(0, 0, 0, 0) line.__class__ = ModifiedSegment line.setVisible(0) setupCommonStyle(line, marker) label = make.info_label("TR", [MzCursorInfo(marker, line)], title=None) label.labelparam.label = "" self.marker = marker self.label = label self.line = line
def make_measurement_line(): line = make.segment(0, 0, 0, 0) line.__class__ = MesaurementLine return line