Код: Выделить всё
import numpy as np
import pyqtgraph as pg
win = pg.plot()
win.setWindowTitle('MWE legend offset')
c1 = win.plot([np.random.randint(0,8) for i in range(10)], pen='r', name='curve1')
legend = pg.LegendItem((80,60), offset=(70,20))
legend.setParentItem(win.graphicsItem())
legend.addItem(c1, 'curve1')
print(f"Before setting an offset: {legend.offset}") # Gives (70,20)
legend.setOffset([300,300])
print(f"After setting an offset: {legend.offset}") # Gives (70,20) as well
if __name__ == '__main__':
pg.exec()
Подробнее здесь: https://stackoverflow.com/questions/789 ... f-position