我正在尝试添加带有字符串((2,3,5,1),(11:30 pm,12:00am,12:30am,1:00am)的x轴。我已经看到一个由addPlot(axisItems)Show string values on x-axis in pyqtgraph使用pytgraph.GraphicsWindow()完成的示例,但是没有用于PlotWidget()添加x轴的addPlot。
答案 0 :(得分:0)
GraphicsWindows
继承自GraphicsLayout
,其addPlot
方法创建一个PlotItem
,然后将其所有参数传递给PlotItem
构造函数。
PlotWidget
类包装单个PlotItem
,并且PlotWidget
构造函数还将其参数传递给PlotItem
构造函数。
因此,您应该只能够将axisItems
参数传递给PlotWidget
构造函数。像这样:
myPlotWidget = PlotWidget(axisItems={'bottom': stringaxis})