From 33e4a9e21307cc2c2235a838f002a1c961de66a7 Mon Sep 17 00:00:00 2001 From: Luke Campagnola <luke.campagnola@gmail.com> Date: Sun, 5 Jan 2014 14:40:56 -0500 Subject: [PATCH] Fix: prevent divide-by-zero in AxisItem --- CHANGELOG | 2 +- pyqtgraph/graphicsItems/AxisItem.py | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e9ab5d7d..1457e9f6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -38,7 +38,7 @@ pyqtgraph-0.9.9 [unreleased] - fixed PlotCurveItem generating exceptions when data has length=0 - fixed ImageView.setImage only working once - PolyLineROI.setPen() now changes the pen of its segments as well - + - Prevent divide-by-zero in AxisItem pyqtgraph-0.9.8 2013-11-24 diff --git a/pyqtgraph/graphicsItems/AxisItem.py b/pyqtgraph/graphicsItems/AxisItem.py index 425fdd93..0ddd02a8 100644 --- a/pyqtgraph/graphicsItems/AxisItem.py +++ b/pyqtgraph/graphicsItems/AxisItem.py @@ -458,8 +458,7 @@ class AxisItem(GraphicsWidget): return [] ## decide optimal minor tick spacing in pixels (this is just aesthetics) - pixelSpacing = size / np.log(size) - optimalTickCount = max(2., size / pixelSpacing) + optimalTickCount = max(2., np.log(size)) ## optimal minor tick spacing optimalSpacing = dif / optimalTickCount -- GitLab