用pyqtgraph绘制曲线图时,曲线左右两端和y轴之间会有一小段空白,其消除方法如下:
import pyqtgraph as pg
plot = pg.PlotItem()
viewbox = plot.getViewBox()
viewbox.setDefaultPadding(padding=0) # padding默认值为0.02,所以默认有空白
效果对比:
去除前:
去除后:
用pyqtgraph绘制曲线图时,曲线左右两端和y轴之间会有一小段空白,其消除方法如下:
import pyqtgraph as pg
plot = pg.PlotItem()
viewbox = plot.getViewBox()
viewbox.setDefaultPadding(padding=0) # padding默认值为0.02,所以默认有空白
效果对比:
去除前:
去除后: