Hi all,
I am trying to connect two Y axis of two plots located in different docks.
However, I get a strange behavior.
Please see a minimal (non)working example here:
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg
from pyqtgraph.dockarea import *
x = np.linspace(-50, 50, 1000)
y = np.sin(x) / x
app = QtGui.QApplication([])
win = QtGui.QMainWindow()
area = DockArea()
win.setCentralWidget(area)
win.resize(1000,500)
d1 = Dock("Dock1", size=(500, 100))
d3 = Dock("Dock3", size=(200, 100))
d2 = Dock("Dock2 - Console", size=(500,400))
area.addDock(d1, 'left')
area.addDock(d3, 'right')
area.addDock(d2, 'bottom',d3)
p1 = pg.PlotWidget()
d1.addWidget(p1)
p1.plot(x,y)
p2 = pg.PlotWidget()
d2.addWidget(p2)
p2.plot(x,y)
p2.setYLink(p1)
win.show()
## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
Please note that dock 3 (d3) is only useful for splitting the screen
vertically.
As you may appreciate, the only situation that works fine is for d2 of
equal height than d1, otherwise there seem to exist an offset between the
two. It doesn't seem to be related to the aspect ratio too, as modifying d2
width does not change the conclusions.
Do I do anything wrong? Any idea to get the expected behavior?
Thank you in advance.
Kind regards,
Bruno
--
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/3f548fd4-503a-4d6d-a9a4-43c0c18b9ee3n%40googlegroups.com.