Dear All,
I am developing an application in which graphs are embedded in a PyQt 
arrangement of Buttons, Widgets and the like, and am therefore using the 
PlotWidget method.  Mostly it is working fine, but when I encounter data 
with a large range, more than about 10^12 I think, then my TextItems 
disappear.  I attach a demonstration script based on the PlotWidget.py 
example. I am using PyQtgraph 0.10.0 with Python 3.6

Any suggestions gratefully received!

Geof


-- 
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/cce0e70e-7dd8-4421-a2b7-bf9e6b3a9c81%40googlegroups.com.
from pyqtgraph.Qt import QtGui, QtCore
import numpy as np
import pyqtgraph as pg

app = QtGui.QApplication([])
mw = QtGui.QMainWindow()
mw.setWindowTitle('pyqtgraph example: PlotWidget')
mw.resize(800,400)
cw = QtGui.QWidget()
mw.setCentralWidget(cw)
l = QtGui.QVBoxLayout()
cw.setLayout(l)
pw = pg.PlotWidget()
l.addWidget(pw)
mw.show()

p1 = pw.plot()

pw.setXRange(0, 2)

# if YRANGE=1e10 then the TextItem is visible, but if YRANGE=1e20 it isn't
# YRANGE=1e10
YRANGE=1e20

def rand(n):
    data = np.random.random(n)
    data *= YRANGE
    return data, np.arange(n, n+len(data)) / float(n)
    
yd, xd = rand(1000)
p1.setData(y=yd, x=xd)

text = pg.TextItem("Hello")
pw.addItem(text)
text.setPos(0.5, 0.5*YRANGE)

app.exec_()

Reply via email to