Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge for v8.1.1 #238

Merged
merged 3 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion eomaps/_blit_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,13 @@
cv.restore_region(bg)

for a in artists:
self.figure.draw_artist(a)
try:
self.figure.draw_artist(a)
except np.linalg.LinAlgError:

Check warning on line 1418 in eomaps/_blit_manager.py

View check run for this annotation

Codecov / codecov/patch

eomaps/_blit_manager.py#L1418

Added line #L1418 was not covered by tests
# Explicitly catch numpy LinAlgErrors resulting from singular matrices
# that can occur when colorbar histogram sizes are dynamically updated
if _log.getEffectiveLevel() <= logging.DEBUG:
_log.debug(f"problem drawing artist {a}", exc_info=True)

Check warning on line 1422 in eomaps/_blit_manager.py

View check run for this annotation

Codecov / codecov/patch

eomaps/_blit_manager.py#L1421-L1422

Added lines #L1421 - L1422 were not covered by tests

if blit:
cv.blit()
Expand Down
17 changes: 6 additions & 11 deletions eomaps/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,31 +255,26 @@ def xchanged(event):
self.ax_cb_plot.callbacks.connect("ylim_changed", ychanged)

def _hide_singular_axes(self):

sing_hist = (self.ax_cb_plot.bbox.width <= 2) or (
self.ax_cb_plot.bbox.height <= 2
)
sing_cb = (self.ax_cb.bbox.width <= 2) or (self.ax_cb.bbox.height <= 2)

# trigger a draw to update axes positions before checking singularity
# (ignore any errors in here to avoid any remaining issues with singular axes
# if hist-updates are triggered faster than draw-events...)
try:
self._m.f.canvas.draw()
except Exception:
pass

sing_hist = (self.ax_cb_plot.bbox.width <= 2) or (
self.ax_cb_plot.bbox.height <= 2
)
sing_cb = (self.ax_cb.bbox.width <= 2) or (self.ax_cb.bbox.height <= 2)

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

if sing_cb:
if sing_cb and self._hist_size > 0.99:
self.ax_cb.set_visible(False)
else:
self.ax_cb.set_visible(True)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ eomaps = ["logo.png", "NE_features.json", "qtcompanion/icons/*"]

[project]
name = "eomaps"
version = "8.1"
version = "8.1.1"
description = "A library to create interactive maps of geographical datasets."
readme = "README.md"
license = {file = "LICENSE"}
Expand Down
Loading