Hello,
I have problems to get the Plot Grid shown for my custom layout PlotWidget.
So I have GraphicsLayoutWidget() which contains multiple ViewBoxes with linked AxisItems, every thing is shown correctly except the Grid. When I turn on the grid by calling setGrid on the AxisItem also the ticks on the axis disappear and no grid lines are shown.
Does anyone have a hint for me, why this is not working?
Here is some simple example code:
import pyqtgraph as pg
from PyQt4 import QtGui
import numpy as np
def main():
import sys
app = QtGui.QApplication(sys.argv)
plotLayout = pg.GraphicsLayoutWidget()
p1 = pg.ViewBox()
line = pg.PlotDataItem(y=np.random.random(400))
p1.addItem(line)
plotLayout.addItem(p1,0,0)
xAxis = pg.AxisItem('bottom')
xAxis.setZValue(-1000)
xAxis.setFlag(xAxis.ItemNegativeZStacksBehindParent)
xAxis.setGrid(1.0)
xAxis.linkToView(p1)
plotLayout.addItem(xAxis,1,0)
plotLayout.show()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
Thank you,
Stefan