Skip to content

Commit ffd1eae

Browse files
committed
introduced fix for api change
1 parent 8135c7b commit ffd1eae

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

spb/backends/matplotlib/renderers/implicit2d.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from spb.backends.matplotlib.renderers.renderer import MatplotlibRenderer
2+
from packaging import version
23

34

45
def _matplotlib_list(interval_list):
@@ -82,11 +83,19 @@ def _draw_implicit2d_helper(renderer, data):
8283

8384
def _update_implicit2d_helper(renderer, data, handle):
8485
p = renderer.plot
86+
current_version = version.parse(p.matplotlib.__version__)
87+
v_3_10_0 = version.parse("3.10.0")
88+
8589
if len(data) == 2:
8690
raise NotImplementedError
8791
else:
88-
for c in handle[0].collections:
89-
c.remove()
92+
if current_version < v_3_10_0:
93+
for c in handle[0].collections:
94+
c.remove()
95+
else:
96+
# NOTE: API changed with Matplotlib 3.10.0
97+
# https://matplotlib.org/stable/api/prev_api_changes/api_changes_3.10.0.html#numdecs-parameter-and-attribute-of-loglocator
98+
handle[0].remove()
9099
xx, yy, zz, plot_type = data
91100
kw = handle[1]
92101
if plot_type == "contour":

0 commit comments

Comments
 (0)