pyqtgraph를 사용 중이고 InfiniteLines의 범례에 항목을 추가하고 싶습니다.pyqtgraph : 플롯의 줄에 범례 추가
# -*- coding: utf-8 -*-
"""
Demonstrates basic use of LegendItem
"""
import initExample ## Add path to library (just for examples; you do not need this)
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
plt = pg.plot()
plt.setWindowTitle('pyqtgraph example: Legend')
plt.addLegend()
c1 = plt.plot([1,3,2,4], pen='r', name='red plot')
c2 = plt.plot([2,1,4,3], pen='g', fillLevel=0, fillBrush=(255,255,255,30), name='green plot')
c3 = plt.addLine(y=4, pen='y')
# TODO: add legend item indicating "maximum value"
## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
내가 결과적으로 얻을 것은 :
내가 적절한 범례 항목을 추가하려면 어떻게
나는 보여주기 위해 예제 코드를 적용했습니다?
이 예를 들어
** ** plt.addLegend()를 호출하기 전에 ** 감사합니다. 나는 거의 그것을 놓쳤습니다. :) –