Exemple #1
0
def create_image_widget():
    # patched plot in widget
    widget = ImageWidget(lock_aspect_ratio=False, xlabel="rt", ylabel="m/z")

    # patch memeber's methods:
    widget.plot.__class__ = ModifiedImagePlot
    widget.plot.set_axis_direction("left", False)
    widget.plot.set_axis_direction("right", False)

    set_x_axis_scale_draw(widget)
    set_y_axis_scale_draw(widget)
    widget.plot.enableAxis(widget.plot.colormap_axis, False)

    return widget
Exemple #2
0
    def __init__(self, parent, xlabel, ylabel, modified_parent_class=None):
        super(PlotWidget, self).__init__(parent)

        self.layout = QtGui.QGridLayout(self)

        self.widget = CurveWidget(parent, xlabel=xlabel, ylabel=ylabel)
        set_y_axis_scale_draw(self.widget) 
        # inject modified behaviour of widgets plot:
        if modified_parent_class is not None:
            self.widget.plot.__class__ = modified_parent_class

        self.plot = self.widget.plot

        sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
        self.widget.setSizePolicy(sizePolicy)

        left, top, right, bottom = 0, 0, 0, 0
        self.widget.setContentsMargins(left, top, right, bottom)
        self.layout.setContentsMargins(left, top, right, bottom)
        self.layout.addWidget(self.widget, 0, 0, 1, 1)
        self.del_foreground_items()
        self.del_background_items()