Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在将二维直方图绘制为 pyqtgraph 中的图像。我想正确设置轴刻度(即表示分箱数据的实际值)。
我找到了这篇文章,但我不太确定如何将其翻译成我的案例。
我愿意:
h = np.histogram2d(x, y, 30, normed = True) w = pg.ImageView(view=pg.PlotItem()) w.setImage(h[0])
但是轴的比例PlotItem从 0 到 30(箱数),这不是我想要的。
PlotItem
您需要设置图像的位置和比例。您提供的链接具有以下代码:
view.setImage(img, pos=[x0, y0], scale=[xscale, yscale])
您只需根据 h[1] 中的 bin 值确定 [x0, y0] 和 [xscale, yscale] 的正确值。