When using pyqtgraph.PColorMeshItem,when using pyqtgraph.PColorMeshItem

66 views
Skip to first unread message

牟明非

unread,
Jul 19, 2023, 5:37:11 AM7/19/23
to pyqtgraph
When using pyqtgraph.PColorMeshItem, pyqtgraph.DateAxisItem is used as its X-axis, and the range of the X-axis is set, but either the image doesn't line up with the X-axis or it doesn't show the image, can you help me?

MINGFEI MU

unread,
Jul 19, 2023, 5:40:13 AM7/19/23
to pyqtgraph

Here's my code, the axis range is correct, but there's no image

self.plot_widget = pg.GraphicsLayoutWidget(show=True)
date_axis = pg.DateAxisItem(orientation='bottom')
date_axis.setLabel('time')
view = self.plot_widget.addPlot(0, 0, title="image", 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)
Reply all
Reply to author
Forward
0 new messages