I need dynamically update plot title on a grid and MultiplePlotAxes (depend on request) plot for live streaming data follow. I would like to change title whether the plot has MultiplePlotAxes or not, but I could not figure out how to get current plot title and update it.
For simplicity code snippet from example of pyqtgraph:
import pyqtgraph as pg
pg.mkQApp()
pw = pg.PlotWidget(title='need to be update dynamically title :(')
pw.show()
p1 = pw.plotItem
p1.setLabels(left='axis 1')
p2 = pg.ViewBox()
p1.showAxis('right')
p1.scene().addItem(p2)
p1.getAxis('right').linkToView(p2)
p2.setXLink(p1)
p1.getAxis('right').setLabel('axis2', color='#0000ff')
def updateViews():
p2.setGeometry(p1.vb.sceneBoundingRect())
p2.linkedViewChanged(p1.vb, p2.XAxis)
updateViews()
p2.addItem(pg.PlotCurveItem([10, 20, 40, 80, 40, 20], pen='b'))
p1.plot([1, 2, 4, 8, 16, 32])
pg.exec()