I want to display multiples of π on yaxis of my plot. I suceeded to space
the ticks by 50π but i didn't find in the documentation how to associate
the ticks float values (ex: 6.28...) i obtain with a string containing the
corresponding factor of π (ex: 2π). No more lucky on the web...
So here is my code :
import pyqtgraph as pg
pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
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.setLabel("left", ylabel2)
PLOT2.getAxis("left").setTickSpacing(50*np.pi, 1)
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()
Does anybody have a solution ? Maybe it's not possible ?
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/54c766ad-d876-4824-9ae4-3f359ceb88bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.