Skip to content

Commit c83405b

Browse files
authored
Merge pull request #238 from raphaelquast/dev
Merge for v8.1.1
2 parents 2c7e41d + 034ce66 commit c83405b

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

eomaps/_blit_manager.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,13 @@ def blit_artists(self, artists, bg="active", blit=True):
14131413
cv.restore_region(bg)
14141414

14151415
for a in artists:
1416-
self.figure.draw_artist(a)
1416+
try:
1417+
self.figure.draw_artist(a)
1418+
except np.linalg.LinAlgError:
1419+
# Explicitly catch numpy LinAlgErrors resulting from singular matrices
1420+
# that can occur when colorbar histogram sizes are dynamically updated
1421+
if _log.getEffectiveLevel() <= logging.DEBUG:
1422+
_log.debug(f"problem drawing artist {a}", exc_info=True)
14171423

14181424
if blit:
14191425
cv.blit()

eomaps/colorbar.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -255,31 +255,26 @@ def xchanged(event):
255255
self.ax_cb_plot.callbacks.connect("ylim_changed", ychanged)
256256

257257
def _hide_singular_axes(self):
258-
259258
sing_hist = (self.ax_cb_plot.bbox.width <= 2) or (
260259
self.ax_cb_plot.bbox.height <= 2
261260
)
262261
sing_cb = (self.ax_cb.bbox.width <= 2) or (self.ax_cb.bbox.height <= 2)
263262

264-
# trigger a draw to update axes positions before checking singularity
265-
# (ignore any errors in here to avoid any remaining issues with singular axes
266-
# if hist-updates are triggered faster than draw-events...)
267-
try:
268-
self._m.f.canvas.draw()
269-
except Exception:
270-
pass
271-
272263
sing_hist = (self.ax_cb_plot.bbox.width <= 2) or (
273264
self.ax_cb_plot.bbox.height <= 2
274265
)
275266
sing_cb = (self.ax_cb.bbox.width <= 2) or (self.ax_cb.bbox.height <= 2)
276267

277-
if sing_hist:
268+
# use additional constraint < 0.1 to re-show axes after they have been hidden
269+
# (positions of hidden axes are not updated so we don't know the new position
270+
# before re-drawing... and a re-draw is not wanted because it would fetch
271+
# a new unnecessary background
272+
if sing_hist and self._hist_size < 0.01:
278273
self.ax_cb_plot.set_visible(False)
279274
else:
280275
self.ax_cb_plot.set_visible(True)
281276

282-
if sing_cb:
277+
if sing_cb and self._hist_size > 0.99:
283278
self.ax_cb.set_visible(False)
284279
else:
285280
self.ax_cb.set_visible(True)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ eomaps = ["logo.png", "NE_features.json", "qtcompanion/icons/*"]
1111

1212
[project]
1313
name = "eomaps"
14-
version = "8.1"
14+
version = "8.1.1"
1515
description = "A library to create interactive maps of geographical datasets."
1616
readme = "README.md"
1717
license = {file = "LICENSE"}

0 commit comments

Comments
 (0)