#add legend to the plot, for that we have to give a name to plot items w.addLegend() # adding a regular data item (non-taurus) c1 = pg.PlotDataItem(name='st plot', pen='b', fillLevel=0, brush='c') c1.setData(numpy.arange(300) / 300.) w.addItem(c1) pen = pg.mkPen(color='r', style=4) brush = pg.mkBrush(color='b') brush.setStyle(3) # adding a taurus data item # c2 = TaurusPlotDataItem(name='st2 plot', pen='r', symbol='o') c2 = TaurusPlotDataItem(pen=pen, name='foo') # c2 = TaurusPlotDataItem() # c2.loadConfigFile('tmp/conf.cfg') c2.setModel('eval:Quantity(rand(256),"m")') # c2.setModel('sys/tg_test/1/wave') # c2.setModel(None) # c2.setXModel(None) # c2.setXModel('eval:Quantity(rand(256),"m")') w.addItem(c2) # ...and remove it after a while def rem():
"""Example on using a tpg.TaurusPlotDataItem on a pure pyqtgraph plot""" if __name__ == '__main__': import sys import numpy from taurus.qt.qtgui.application import TaurusApplication from taurus.qt.qtgui.tpg import TaurusPlotDataItem import pyqtgraph as pg app = TaurusApplication() # a standard pyqtgraph plot_item w = pg.PlotWidget() #add legend to the plot, for that we have to give a name to plot items w.addLegend() # add a regular data item (non-taurus) c1 = pg.PlotDataItem(name='pg item', pen='b', fillLevel=0, brush='c') c1.setData(numpy.linspace(0, 2, 250)) w.addItem(c1) # add a taurus data item c2 = TaurusPlotDataItem(name='taurus item', pen='r', symbol='o') c2.setModel('eval:Quantity(rand(256),"m")') w.addItem(c2) w.show() sys.exit(app.exec_())
"""Remove this axis from its attached PlotItem (not yet implemented) """ pass # TODO if __name__ == '__main__': import sys import pyqtgraph as pg from taurus.qt.qtgui.application import TaurusApplication from taurus.qt.qtgui.tpg import TaurusPlotDataItem app = TaurusApplication() # a standard pyqtgraph plot_item w = pg.PlotWidget() axis = DateAxisItem(orientation='bottom') axis.attachToPlotItem(w.getPlotItem()) # adding a taurus data item c2 = TaurusPlotDataItem() w.addItem(c2) w.show() sys.exit(app.exec_())
y2ViewBox.attachToPlotItem(w.getPlotItem()) # adding a regular data item (non-taurus) c1 = pg.PlotDataItem( name="st plot", pen=dict(color="y", width=3, style=QtCore.Qt.DashLine), fillLevel=0.3, fillBrush="g", ) c1.setData(numpy.arange(300) / 300.0) w.addItem(c1) # adding a taurus data item c2 = TaurusPlotDataItem(name="st2 plot", pen="r", symbol="o", symbolSize=10) c2.setModel("sys/tg_test/1/wave") w.addItem(c2) # attach tool to plot item of the PlotWidget tool = CurvesPropertiesTool() tool.attachToPlotItem(w.getPlotItem(), y2=y2ViewBox) w.show() # directly trigger the tool tool.trigger() sys.exit(app.exec_())
"""Example on using a tpg.TaurusPlotDataItem on a pure pyqtgraph plot""" if __name__ == "__main__": import sys import numpy from taurus.qt.qtgui.application import TaurusApplication from taurus.qt.qtgui.tpg import TaurusPlotDataItem import pyqtgraph as pg app = TaurusApplication() # a standard pyqtgraph plot_item w = pg.PlotWidget() # add legend to the plot, for that we have to give a name to plot items w.addLegend() # add a regular data item (non-taurus) c1 = pg.PlotDataItem(name="pg item", pen="b", fillLevel=0, brush="c") c1.setData(numpy.linspace(0, 2, 250)) w.addItem(c1) # add a taurus data item c2 = TaurusPlotDataItem(name="taurus item", pen="r", symbol="o") c2.setModel('eval:Quantity(rand(256),"m")') w.addItem(c2) w.show() sys.exit(app.exec_())
y2ViewBox = Y2ViewBox() y2ViewBox.attachToPlotItem(w.getPlotItem()) # adding a regular data item (non-taurus) c1 = pg.PlotDataItem( name='st plot', pen=dict(color='y', width=3, style=QtCore.Qt.DashLine), fillLevel=0.3, fillBrush='g' ) c1.setData(numpy.arange(300)/300.) w.addItem(c1) # adding a taurus data item c2 = TaurusPlotDataItem(name='st2 plot', pen='r', symbol='o', symbolSize=10) c2.setModel('sys/tg_test/1/wave') w.addItem(c2) # attach tool to plot item of the PlotWidget tool = CurvesPropertiesTool() tool.attachToPlotItem(w.getPlotItem(), y2=y2ViewBox) w.show() # directly trigger the tool tool.trigger () sys.exit(app.exec_())