I want to use pyqtgraph plot a time-price curve.
like this:
I already knew how to set custom axisitem refer
My question is if there was a way to show i needed tick string instead of all?
How to skip these tick string
There is a demo and some data just for example:
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore
time=['09:38:21','09:37:41','09:37:16','09:37:11','09:36:46',
'09:36:31','09:36:01','09:35:36','09:35:31','09:35:26',
'09:35:06','09:34:46','09:34:06','09:33:41','09:33:36',
'09:33:21','09:33:16','09:33:11','09:33:01','09:32:46',
'09:32:36','09:32:26','09:32:16','09:32:01','09:31:46',
'09:31:41','09:31:21','09:30:46','09:30:06','09:25:06']
price=[6.08,6.08,6.07,6.09,6.09,6.09,6.09,6.09,6.08,6.09,6.09,
6.09,6.09,6.07,6.07,6.06,6.06,6.06,6.06,6.06,6.07,6.08,
6.08,6.07,6.07,6.07,6.08,6.08,6.08,6.09 ]
xDict=dict(enumerate(time))
xValue=list(xDict.keys())
win = pg.GraphicsWindow()
bottomAxis = pg.AxisItem(orientation='bottom')
plot = win.addPlot(axisItems={'bottom': bottomAxis},name='price')
xtickts=[xDict.items()]
bottomAxis.setTicks(xtickts)
plot.plot(xValue,price)
if __name__ == '__main__':
import sys
if sys.flags.interactive != 1 or not hasattr( QtCore, 'PYQT_VERSION' ):
pg.QtGui.QApplication.exec_()
How can I avoid show all the time tick string?