【问题标题】:pyqtgraph: plot with a similar functionality as matplotlib drawstylepyqtgraph:具有与 matplotlib drawstyle 类似功能的绘图
【发布时间】:2013-07-17 08:26:21
【问题描述】:

pyqtgraph 中是否有可能获得 蓝色图 而不是红色图,这是 matplotlib 和以下 matplotlib 示例中的 pyqtgraph 中的标准方法:

import matplotlib.pyplot as plt 
import numpy as np

x = np.arange(0,1,0.1)
y = [0,0,0,2,2,8,9,2,0,0]

plt.plot(x,y,color='red',drawstyle='standard')
plt.plot(x,y,color='blue',drawstyle='steps-post')

plt.show()

到目前为止,我还没有找到使用给定数据 x 和 y 在 pyqtgraph 中创建蓝色图形的方法。

非常感谢 问候 迈克尔

【问题讨论】:

    标签: python plot pyqtgraph


    【解决方案1】:

    这在 pyqtgraph 'histogram' 示例中有所描述。这是翻译:

    import pyqtgraph as pg
    import numpy as np
    
    x = np.arange(0,1,0.1)
    y = [0,0,0,2,2,8,9,2,0,0]
    print len(x), len(y)
    
    plt = pg.plot(x,y,pen='r')
    curve2 = pg.PlotCurveItem(x,y[:-1],pen='b',stepMode=True)
    plt.addItem(curve2)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-04-23
      • 2011-12-24
      • 2016-10-12
      • 1970-01-01
      • 2021-10-21
      • 1970-01-01
      相关资源
      最近更新 更多