-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
When working in log mode, it is very easy to zoom out until AxisItem can no longer handle the magnitude of the numbers involved.
An easy fix might be to set a default limit on the maximum range?
Steps to reproduce
- Run the code below to show a plot in y-axis logarithmic mode.
- Point at the vertical axis.
- Spin the mousewheel down.
- Spin it again. On my system, this increases the displayed range to more then 1E-300 to 1E+300. Any values outside this range display as "inf" and "0".
- The following warning starts appearing:
..\pyqtgraph\graphicsItems\AxisItem.py:845: RuntimeWarning: overflow encountered in power estrings = ["%0.1g"%x for x in 10 ** np.array(values).astype(float) * np.array(scale)] - Spin the wheel one more time.
- The only labels are now "0", "1" and "inf".
- The application becomes unresponsive.
- If it recovers, spin down again, it will lock up completely eventually.
import numpy as np
import pyqtgraph as pg
pg.mkQApp()
pw = pg.PlotWidget()
pw.setLogMode(x=False, y=True)
pw.show()
xxx = np.linspace(-3, 3, 601)
yyy = np.sinc(xxx)**2
yyy = (yyy * 16384).astype(np.int16).astype(np.float32) / 16384 # quantize to make nulls 0
item1 = pg.PlotDataItem(pen='r')
item1.setData(xxx,yyy)
pw.addItem(item1)
pg.exec()Expected behavior
The program should not become unresponsive.
Beyond that, I am hoping for comments :)
To me, it does not seem very useful to try and display values outside the +/-1.7E+308 (and E-308) range that a double can handle. So it might be sufficient not to allow any larger range than that, even if working in log mode?
Tested environment(s)
sys.platform: win32
sys.version: 3.9.7 | packaged by conda-forge | (default, Sep 14 2021, 01:11:01) [MSC v.1916 64 bit (AMD64)]
qt bindings: PyQt5 5.12.3 Qt 5.12.9
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels