【问题标题】:How to plot some graph with labels?(pyqtgraph/other)如何用标签绘制一些图?(pyqtgraph/other)
【发布时间】:2019-12-30 20:22:34
【问题描述】:

我尝试绘制一些正方形: 一个 (0,0) 乙 (0,1) C (1,1) D (1,0)

使用pyqtgraph很容易:

    plt = pg.plot([0, 0, 1, 1], [0, 1, 1, 0], pen=None, symbol='o')
    plt.showGrid(x=True, y=True)

但是如何添加标签(如 A、B、C、D)?

【问题讨论】:

    标签: python pyqtgraph


    【解决方案1】:

    你需要使用 setLabel 如下:

    import pyqtgraph as pg
    plt = pg.plot([0, 0, 1, 1], [0, 1, 1, 0], pen=None, symbol='o')
    plt.setLabel('left', "A")
    plt.setLabel('bottom', "B")
    plt.setLabel('right', "C")
    plt.setLabel('top', "D")
    plt.showGrid(x=True, y=True)
    

    【讨论】:

      猜你喜欢
      • 2018-06-22
      • 2015-07-21
      • 2021-03-22
      • 2020-07-09
      • 2014-04-22
      • 2013-07-20
      • 1970-01-01
      • 2016-04-28
      • 2016-02-05
      相关资源
      最近更新 更多