【问题标题】:How to I adjust the height of a PlotWidget?如何调整 PlotWidget 的高度?
【发布时间】:2018-12-07 15:23:09
【问题描述】:

我正在开发一个频谱分析仪 GUI,我正在使用 matplotlib.pyplot 绘制 FFT,并在其下方使用 PyQtGraph 绘制瀑布图。使用ImageItem 创建瀑布显示,将其添加到PlotWidget,然后将其添加到QVBoxLayout 中的FFT 下方。结果是这样的:

我不得不为瀑布显示使用PyQtGraph,因为 MatPlotLib 无法足够快地绘制数据。现在,我无法弄清楚如何调整PlotWidget 的大小,以使两个图形的大小大致相同。 ImageItem 正在使用

生成
ImageItem.setImage(dataArray)

建议?

【问题讨论】:

    标签: python matplotlib pyqt pyqtgraph


    【解决方案1】:

    你应该在第一次更新时使用 scale

    counter += 1
        if counter == 1:
            ImageItem = pg.ImageItem()
            ImageItem.scale((data_storage.x[-1] - data_storage.x[0]) / len(data_storage.x), 1)
    

    【讨论】:

      猜你喜欢
      • 2018-02-26
      • 1970-01-01
      • 1970-01-01
      • 2016-02-18
      • 2020-06-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-07
      相关资源
      最近更新 更多