Hello,
When I draw couples of plots on the same canvas, the width of its legend 
window is wrong (it increases as the number of items increases). Please see 
the snapshot below. I try to print the width of each label (in 
LegendItem.py). It shows that label.width() is wrong except the last in the 
loop (looping self.items). Please confirm. The code is also attached. 

import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np

app = pg.mkQApp()                 
w = pg.GraphicsLayoutWidget()
p = w.addPlot()
legend = p.addLegend()
legend.setParentItem(p)

for i in range(20):
    p.plot(x=range(0,10), y=np.array(range(0,10))*i, name='{0}'.format(i))

w.show()
    
## 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_()


Cheers,
Zhiyi.




-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/02ad0409-cb1f-41c6-b0d3-59cbc82a9ea8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to