Hello,
I found the answer myself by reading more efficiently the doc :-( Sorry for 
that...
Here is my working code :

    def editFigurePyQtGraph(self):

        # Mise en place
        freq_lim = self.freq_lim
        periodo_WK_module_lim = self.periodo_WK_module_lim
        periodo_WK_phase_lim = self.periodo_WK_phase_lim
        titre = self.titre
        xlabel1 = self.xlabel1
        xlabel2 = self.xlabel2
        ylabel1 = self.ylabel1
        ylabel2 = self.ylabel2

        # Affichage du périodogramme d'interaction de WK
        self.win = pg.GraphicsWindow()
        self.win.resize(1100, 800)
        self.win.ci.layout.setColumnFixedWidth(0, 1000)
        self.win.ci.layout.setRowFixedHeight(0, 550)
        self.win.ci.layout.setRowFixedHeight(1, 200)

        PLOT1 = self.win.addPlot(title=titre, row=0, col=0)
        if self.echel == 1:
            PLOT1.plot(freq_lim, periodo_WK_module_lim, pen=pg.mkPen((255, 
192, 0), width=2))
        elif self.echel == 2:
            PLOT1.plot(freq_lim, 20*np.log10(periodo_WK_module_lim), 
pen=pg.mkPen((255, 192, 0), width=2))
        PLOT1.setLabel("bottom", xlabel1)
        PLOT1.setLabel("left", ylabel1)
        PLOT1.showGrid(x=True, y=True)
        PLOT1.showAxis("top", show=True)
        PLOT1.getAxis("top").setStyle(showValues=False)
        PLOT1.showAxis("right", show=True)
        PLOT1.getAxis("right").setStyle(showValues=False)
        PLOT1.showButtons()

        PLOT2 = self.win.addPlot(row=1, col=0)
        PLOT2.plot(freq_lim, periodo_WK_phase_lim, pen=pg.mkPen((255, 192, 
0), width=2))
        PLOT2.getAxis("left").setStyle(tickFont=QtGui.QFont('times'))
        PLOT2.setLabel("left", ylabel2)

        # Fonction pour afficher les radians
        # en multiple de π
        def format_left(base):
            for i in range(-50, 51):
                if np.isclose(0, i, 0, 1e-3):
                    ticks_setting[0].append((0, "0"))
                else:
                    ticks_setting[0].append((i*base*np.pi, "{} 
π".format(i*base)))

        mini = int(np.floor(np.min(periodo_WK_phase_lim)/np.pi))
        maxi = int(np.ceil(np.max(periodo_WK_phase_lim)/np.pi))
        base = int(np.around((maxi-mini)/5, decimals=-1))
        ticks_setting = [[]]
        format_left(base)

        # On affiche les radians en multiples entiers de π
        PLOT2.getAxis("left").setTickSpacing(major=None, minor=base*np.pi)
        PLOT2.getAxis("left").setTicks(ticks_setting)
        PLOT2.showGrid(x=True, y=True)
        PLOT2.showAxis("bottom", show=True)
        PLOT2.getAxis("bottom").setStyle(showValues=False)
        PLOT2.showAxis("top", show=True)
        PLOT2.getViewBox().linkView(PLOT1.getViewBox().XAxis, 
PLOT1.getViewBox())
        PLOT2.showAxis("right", show=True)
        PLOT2.getAxis("right").setStyle(showValues=False)
        PLOT2.showButtons()

Hope that could help...

Regards

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/18be76ad-4a08-4c3e-bc2a-62e251bed6ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to