File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -240,6 +240,7 @@ class Patch3DCollection(PatchCollection):
240
240
241
241
def __init__ (self , * args , ** kwargs ):
242
242
PatchCollection .__init__ (self , * args , ** kwargs )
243
+ self ._old_draw = lambda x : PatchCollection .draw (self , x )
243
244
244
245
def set_3d_properties (self , zs , zdir ):
245
246
xs , ys = zip (* self .get_offsets ())
@@ -259,10 +260,15 @@ def do_3d_projection(self, renderer):
259
260
return min (vzs )
260
261
261
262
def draw (self , renderer ):
262
- PatchCollection . draw ( self , renderer )
263
+ self . _old_draw ( renderer )
263
264
264
265
def patch_collection_2d_to_3d (col , zs = 0 , zdir = 'z' ):
265
266
"""Convert a PatchCollection to a Patch3DCollection object."""
267
+
268
+ # The tricky part here is that there are several classes that are
269
+ # derived from PatchCollection. We need to use the right draw method.
270
+ col ._old_draw = col .draw
271
+
266
272
col .__class__ = Patch3DCollection
267
273
col .set_3d_properties (zs , zdir )
268
274
You can’t perform that action at this time.
0 commit comments