pyqtgraph.PColorMeshItem中怎样设置坐标轴与图像对齐?

我在使用pyqtgraph.PColorMeshItem时,pyqtgraph.DateAxisItem作为其X轴,设置了X轴的范围,但是要么图像与X…
关注者
1
被浏览
1,430
登录后你可以
不限量看优质回答 私信答主深度交流 精彩内容一键收藏

self.plot_widget = pg.GraphicsLayoutWidget(show=True)

date_axis = pg.DateAxisItem(orientation='bottom')
date_axis.setLabel('时间') # 设置横坐标的标签文本
view = self.plot_widget.addPlot(0, 0, title="瀑布图", axisItems={'bottom': date_axis})
time = np.array([t.timestamp() * 1e6 for t in self.time_list])
plt = pg.PColorMeshItem()
view.addItem(plt)
view.invertY()
view.setXRange(time.min() / 1e6, time.max() / 1e6)
plt.setData(self.data.T)
bar_static = pg.ColorBarItem(
label="",
colorMap=pg.colormap.getFromMatplotlib('jet'),
orientation='vertical')
bar_static.setImageItem([plt])
self.plot_widget.addItem(bar_static, 0, 1)

这是我代码,坐标轴范围对了,但是没有图像

发布于 2023-07-17 17:40 ・IP 属地四川