当前位置:   article > 正文

使用pyqtgraph绘制热力图heatmap_pyqtgraph 热力图

pyqtgraph 热力图
import numpy as np
import pyqtgraph as pg
from scipy.ndimage import gaussian_filter
app = pg.mkQApp("Plotting Example")
win = pg.GraphicsLayoutWidget(show=True, title="Basic plotting examples")
win.resize(1200, 600)
win.setWindowTitle('pyqtgraph example: Plotting')
plot1 = win.addPlot(title="Multiple curves")
# win.nextRow()
plot2 = win.addPlot(title="Multiple curves")
imData = np.random.normal(size=(100, 100))*100
imData[10,30] =4000
imData[50, 80] = 2000
imData[50, 80] = 6000
imData = gaussian_filter(imData,3)
img = pg.ImageItem(imData)
img2 = pg.ImageItem(imData)
plot1.addItem(img)
plot1.addColorBar(img, colorMap='CET-R4',
                  values=(-100, 100))  # , interactive=False)
plot2.addItem(img2)
plot2.addColorBar(img2, colorMap=pg.colormap.get('hsv', source='matplotlib', skipCache=True),
                  values=(-100, 100))  # , interactive=False)
pg.exec()
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24

结果如下:
123321

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/230191
推荐阅读
相关标签
  

闽ICP备14008679号