@@ -44,10 +44,6 @@ def draw(self, renderer: RendererBase):
44
44
self ._artist .set_clip_box (clip_box_orig )
45
45
46
46
47
- class SharedRenderDepth :
48
- current_depth = 0
49
-
50
-
51
47
def view_wrapper (axes_class : Type [Axes ]) -> Type [Axes ]:
52
48
"""
53
49
Construct a ViewAxes, which subclasses, or wraps a specific Axes subclass.
@@ -146,6 +142,9 @@ def _init_vars(
146
142
raise ValueError (f"The filter function must be a callable!" )
147
143
148
144
self .__view_axes = axes_to_view
145
+ self .figure ._current_render_depth = getattr (
146
+ self .figure , "_current_render_depth" , 0
147
+ )
149
148
self .__image_interpolation = image_interpolation
150
149
self .__max_render_depth = render_depth
151
150
self .__filter_function = filter_function
@@ -186,9 +185,9 @@ def draw(self, renderer: RendererBase = None):
186
185
# It is possible to have two axes which are views of each other
187
186
# therefore we track the number of recursions and stop drawing
188
187
# at a certain depth
189
- if (SharedRenderDepth . current_depth >= self .__max_render_depth ):
188
+ if (self . figure . _current_render_depth >= self .__max_render_depth ):
190
189
return
191
- SharedRenderDepth . current_depth += 1
190
+ self . figure . _current_render_depth += 1
192
191
# Set the renderer, causing get_children to return the view's
193
192
# children also...
194
193
self .__renderer = renderer
@@ -197,7 +196,7 @@ def draw(self, renderer: RendererBase = None):
197
196
198
197
# Get rid of the renderer...
199
198
self .__renderer = None
200
- SharedRenderDepth . current_depth -= 1
199
+ self . figure . _current_render_depth -= 1
201
200
202
201
def get_linescaling (self ) -> bool :
203
202
"""
0 commit comments