Hi there,
I have a scatter plot within one PlotItem. Before I added a TextItem, AutoRange is fine.
However, when I added a TextItem and then cleared the scatter plot, pyqtgraph(v0.9.10 and v0.10.0+g4cdc3acm) failed to determine
the range of the axis with error messages:
Warning (from warnings module):
File "C:\Python35\lib\site-packages\pyqtgraph\graphicsItems\AxisItem.py", line 844
xScale = bounds.width() / dif
RuntimeWarning: overflow encountered in double_scalars
Warning (from warnings module):
File "C:\Python35\lib\site-packages\pyqtgraph\graphicsItems\AxisItem.py", line 847
xRange = [x * xScale - offset for x in self.range]
RuntimeWarning: invalid value encountered in double_scalars
Warning (from warnings module):
File "C:\Python35\lib\site-packages\pyqtgraph\graphicsItems\AxisItem.py", line 871
x = (v * xScale) - offset
RuntimeWarning: invalid value encountered in double_scalars
Warning (from warnings module):
File "C:\Python35\lib\site-packages\pyqtgraph\graphicsItems\AxisItem.py", line 841
xScale = -bounds.height() / dif
RuntimeWarning: overflow encountered in double_scalars
The problematic code is as follows:
import pyqtgraph as pg
win = pg.GraphicsWindow()
itemT2 = pg.PlotItem(enableMenu=False)
win.addItem(itemT2)
textT2=pg.TextItem(text='a')
itemT2.addItem(textT2) ## XXX - AutoRange failed when adding a TextItem
T2Scatter = itemT2.scatterPlot(pen='r')
x=[ 0.00015 , 0.000285, 0.00042 , 0.000555, 0.00069 , 0.000825,
0.00096 , 0.001095, 0.00123 , 0.001365, 0.0015 ]
y=[ 180.10333333, 173.17666667, 155.08333333, 133.89 ,
110.47 , 93.16333333, 83.42666667, 80.58 ,
72.99333333, 75.37 , 73.51 ]
T2Scatter.setData(x, y)
T2Scatter.clear()