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):
240240
241241 def __init__ (self , * args , ** kwargs ):
242242 PatchCollection .__init__ (self , * args , ** kwargs )
243+ self ._old_draw = lambda x : PatchCollection .draw (self , x )
243244
244245 def set_3d_properties (self , zs , zdir ):
245246 xs , ys = zip (* self .get_offsets ())
@@ -259,10 +260,15 @@ def do_3d_projection(self, renderer):
259260 return min (vzs )
260261
261262 def draw (self , renderer ):
262- PatchCollection . draw ( self , renderer )
263+ self . _old_draw ( renderer )
263264
264265def patch_collection_2d_to_3d (col , zs = 0 , zdir = 'z' ):
265266 """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+
266272 col .__class__ = Patch3DCollection
267273 col .set_3d_properties (zs , zdir )
268274
You can’t perform that action at this time.
0 commit comments