Hey guys, I'm here again with a pyqt-graph question. I want to do a
BarGraph with the same xAxis but two different yAxis (left and right)
related to the same values. For example in the left yAxis the % and in the
right axis the values. So the left axis must be [0,1] and the right [0,
yMax]. I've done some work on this but I'm stuck. In the following code I
make two bargraphitem and I thinks that's not what I want.
resultWindow = pg.plot()
resultWindow.setBackground('w')
resultWindow.setXRange(0,16, 0.05)
resultWindow.setYRange(0, 1, 0.05)
plot1 = resultWindow.getPlotItem()
plot1.showGrid(True, True)
plot2 = pg.ViewBox()
plot1.showAxis('right')
plot1.scene().addItem(plot2)
plot1.getAxis('right').linkToView(plot2)
plot2.setXLink(plot1)
plot1.getAxis('right').setLabel('Frecuencia')
probabilities = [0,0, 0.5, 0.5]
bargraph = pg.BarGraphItem(x=range(pow(2,qbits)), height =
probabilities, width = 0.6, brush ='g')
bargraph2 = pg.BarGraphItem(x=range(pow(2,qbits)), height =
[0,0,100,100], width = 0.6, brush = 'r')
plot1.addItem(bargraph)
plot2.addItem(bargraph2)
#updateViews()
#plot1.vb.sigResized.connect(updateViews)
titleLabel = QLabel("Histograma \n")
vLayout = QVBoxLayout()
vLayout.setContentsMargins(5,5,5,5)
vLayout.addWidget(titleLabel)
vLayout.addWidget(resultWindow)
resultDialog.setLayout(vLayout)
Thanks in advance.
--
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/9c9013b9-c09d-47f0-a197-a57595778182n%40googlegroups.com.