Ejemplo n.º 1
0
class mpl(FigureCanvasQTAgg):
    def __init__(self, parent=None, width=15, height=5, dpi=100):
        self.fig = Figure(figsize=(width, height), dpi=dpi)
        FigureCanvasQTAgg.__init__(self, self.fig)
        self.setParent(parent)
        self.ax = self.fig.add_subplot(111)
        self.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                           QtWidgets.QSizePolicy.Expanding)
        self.updateGeometry()

    def plot(self, *args, **kwargs):
        self.ax.plot(*args, **kwargs)

    def data(self, *args, **kwargs):
        self.ax.plot(*args, **kwargs)
        self.draw()

    def savePNG(self):
        """Save chart image to png file"""
        fmt = "Portable Network Graphics (*.png)"
        fname, ext = QtWidgets.QFileDialog.getSaveFileName(
            self,
            QtWidgets.QApplication.translate("pychemqt", "Save chart to file"),
            "./", fmt)
        if fname and ext == fmt:
            if fname.split(".")[-1] != "png":
                fname += ".png"
            self.fig.savefig(fname, facecolor='#fafafa')
Ejemplo n.º 2
0
class mpl(FigureCanvasQTAgg):
    def __init__(self, parent=None, width=15, height=5, dpi=100):
        self.fig = Figure(figsize=(width, height), dpi=dpi)
        FigureCanvasQTAgg.__init__(self, self.fig)
        self.setParent(parent)
        self.ax = self.fig.add_subplot(111)
        # self.ax.figure.subplots_adjust(left=0.08, right=0.92, bottom=0.1, top=0.95)
        FigureCanvasQTAgg.setSizePolicy(self, QtWidgets.QSizePolicy.Expanding,
                                        QtWidgets.QSizePolicy.Expanding)
        FigureCanvasQTAgg.updateGeometry(self)

    def config(self,
               xmin=None,
               xmax=None,
               ymin=None,
               ymax=None,
               scalex="linear",
               scaley="linear"):
        self.ax.clear()
        self.ax.set_autoscale_on(False)
        self.ax.set_xlabel("Pr", horizontalalignment='right', size='12')
        self.ax.set_ylabel("Z", size='14')
        self.ax.grid(True)
        if xmin != None and xmax != None:
            self.ax.set_xlim(xmin, xmax)
        else:
            self.ax.set_autoscalex_on(True)
        if ymin != None and ymax != None:
            self.ax.set_ylim(ymin, ymax)
        else:
            self.ax.set_autoscaley_on(True)

        self.ax.set_xscale(scalex)
        self.ax.set_yscale(scaley)

    def plot(self, *args, **kwargs):
        self.ax.plot(*args, **kwargs)

    def data(self, *args, **kwargs):
        self.ax.plot(*args, **kwargs)
        self.draw()

    def savePNG(self):
        """Save chart image to png file"""
        fmt = "Portable Network Graphics (*.png)"
        fname, ext = QtWidgets.QFileDialog.getSaveFileName(
            self,
            QtWidgets.QApplication.translate("pychemqt", "Save chart to file"),
            "./", fmt)
        if fname and ext == fmt:
            if fname.split(".")[-1] != "png":
                fname += ".png"
            self.fig.savefig(fname, facecolor='#eeeeee')
Ejemplo n.º 3
0
class mpl(FigureCanvasQTAgg):
    def __init__(self, parent=None, width=15, height=5, dpi=100):
        self.fig = Figure(figsize=(width, height), dpi=dpi)
        FigureCanvasQTAgg.__init__(self, self.fig)
        self.setParent(parent)
        self.ax = self.fig.add_subplot(111)
        # self.ax.figure.subplots_adjust(left=0.08, right=0.92, bottom=0.1, top=0.95)
        FigureCanvasQTAgg.setSizePolicy(self, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        FigureCanvasQTAgg.updateGeometry(self)


    def config(self, xmin=None, xmax=None, ymin=None, ymax=None, scalex="linear", scaley="linear"):
        self.ax.clear()
        self.ax.set_autoscale_on(False)
        self.ax.set_xlabel("Pr", horizontalalignment='right', size='12')
        self.ax.set_ylabel("Z", size='14')
        self.ax.grid(True)
        if xmin!=None and xmax!=None:
            self.ax.set_xlim(xmin, xmax)
        else:
            self.ax.set_autoscalex_on(True)
        if ymin!=None and ymax!=None:
            self.ax.set_ylim(ymin, ymax)
        else:
            self.ax.set_autoscaley_on(True)

        self.ax.set_xscale(scalex)
        self.ax.set_yscale(scaley)

    def plot(self, *args, **kwargs):
        self.ax.plot(*args, **kwargs)

    def data(self, *args, **kwargs):
        self.ax.plot(*args, **kwargs)
        self.draw()

    def savePNG(self):
        """Save chart image to png file"""
        fmt = "Portable Network Graphics (*.png)"
        fname, ext = QtWidgets.QFileDialog.getSaveFileName(
            self,
            QtWidgets.QApplication.translate("pychemqt", "Save chart to file"),
            "./", fmt)
        if fname and ext == fmt:
            if fname.split(".")[-1] != "png":
                fname += ".png"
            self.fig.savefig(fname, facecolor='#eeeeee')