Hello,
I would like to create a single python class to create plots. I would like to create several top methods to use them like that:
windowPlot = myplot()
windowPlot.addSubplot( row = 0, col = 0, name = 'time' )
windowPlot.addCurve( curveName = 'y_vs_t', subplotName = 'time', t, y )
windowPlot.updateData ( curveName = 'y_vs_t', subplotName = 'time', t2, y2 )
windowPlot.refresh()
window.Plot.clear()
''' or '''
windowPlot.subplotDict['time'].curveDict['y_vs_t'].updateData( t2, y2 )
windowPlot.subplotDict['time'].curveDict['y_vs_t'].refresh()
windowPlot.subplotDict['time'].curveDict['y_vs_t'].clear()
Thanks to that, I would like to have an easy and a fast way to plot data, create several plots etc.
I think create three classes like those:
class myplot() # can display several subplots
class subplot() # can display several curves on the same subplot
class curve()
My myplot class will consist of:
- a pyqtgraph GraphicsWindow
- a subplot object dictionary
- methods to add new subplot, new curves, refresh data, update data, clear data...
My subplot class will consist of:
- a pyqtgraph PlotItem
- a curve object dictionary
- methods to add new curves, refresh data, update date, clear data...
My curve class will consist of:
- a pyqtgraph plot
- x and y lists to store data to display
- methods to refresh data, update data, clear data...
I think I am able to create that easily but I am not sure if this is the right way to proceed. Do you have any suggestions ?
Any advice would be appreciated.
Mark