pyqtgraph 自定义网格 [Python/Qt]

pyqtgraph custom grid [Python/Qt]

我试图让我的绘图包含一个具有特定功能(如网格线分隔)的网格,但我不确定 pyqtgraph 是否允许这样做。有人知道如何实现吗?

pyqtgraph 中的 PlotItem class 包含一个 showGrid 函数。例如:

plot_example = pyqtgraph.plot(x_values, y_values)
plot_example.showGrid(True, True, 0.5)

默认情况下,showGrid(x=None, y=None, alpha=None)。第一个参数指定是否显示 x 网格,第二个参数指定是否显示 y 网格,alpha 为网格提供可变的不透明度。

可在此处找到更多信息:http://www.pyqtgraph.org/documentation/_modules/pyqtgraph/graphicsItems/PlotItem/PlotItem.html#PlotItem.showGrid