Skip to content

Commit eaf4d65

Browse files
committed
Average cross section: avoid RuntimeWarning when drawing rectangle
1 parent a522dcb commit eaf4d65

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

plotpy/panels/csection/csitem.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,9 @@ def update_curve_data(self, obj):
321321
sectx, secty = self.get_cross_section(obj)
322322
if secty.size == 0 or np.all(np.isnan(secty)):
323323
sectx, secty = np.array([]), np.array([])
324-
elif self.param.curvestyle != "Steps":
325-
# Center the symbols at the middle of pixels
326-
# Bugfix, we deactivate warnings only for numpy method call.
327-
# (V1.0.10 => V1.0.11)
328-
# Deactivate following warnings after 20210218 mail
329-
# warnings.filterwarnings('ignore')
324+
elif self.param.curvestyle != "Steps" and sectx.size > 1:
325+
# Center the symbols at the middle of pixels:
330326
sectx[:-1] += np.mean(np.diff(sectx) / 2)
331-
# warnings.filterwarnings('default')
332327
if self.orientation() == QC.Qt.Orientation.Vertical:
333328
self.process_curve_data(secty, sectx)
334329
else:

0 commit comments

Comments
 (0)