@@ -548,10 +548,6 @@ def set_3d_properties(self, zs, zdir):
548548 xs = []
549549 ys = []
550550 self ._offsets3d = juggle_axes (xs , ys , np .atleast_1d (zs ), zdir )
551- self ._facecolor3d = self .get_facecolor ()
552- self ._edgecolor3d = self .get_edgecolor ()
553- self ._sizes3d = self .get_sizes ()
554- self ._linewidth3d = self .get_linewidth ()
555551 self .stale = True
556552
557553 def get_depthshade (self ):
@@ -570,38 +566,27 @@ def set_depthshade(self, depthshade):
570566 self ._depthshade = depthshade
571567 self .stale = True
572568
573- def set_facecolor (self , c ):
574- # docstring inherited
575- super ().set_facecolor (c )
576- self ._facecolor3d = self .get_facecolor ()
577-
578- def set_edgecolor (self , c ):
579- # docstring inherited
580- super ().set_edgecolor (c )
581- self ._edgecolor3d = self .get_edgecolor ()
582-
583- def set_sizes (self , sizes , dpi = 72.0 ):
584- # docstring inherited
585- super ().set_sizes (sizes , dpi = dpi )
586- self ._sizes3d = self .get_sizes ()
587-
588- def set_linewidth (self , lw ):
589- # docstring inherited
590- super ().set_linewidth (lw )
591- self ._linewidth3d = self .get_linewidth ()
592-
593569 @cbook ._delete_parameter ('3.4' , 'renderer' )
594570 def do_3d_projection (self , renderer = None ):
571+ xs , ys , zs = self ._offsets3d
572+ vxs , vys , vzs , vis = proj3d .proj_transform_clip (xs , ys , zs ,
573+ self .axes .M )
574+ return np .min (vzs ) if vzs .size else np .nan
575+
576+ @artist .allow_rasterization
577+ def draw (self , renderer ):
578+ self .update_scalarmappable ()
579+
595580 xs , ys , zs = self ._offsets3d
596581 vxs , vys , vzs , vis = proj3d .proj_transform_clip (xs , ys , zs ,
597582 self .axes .M )
598583
599- fcs = (_zalpha (self ._facecolor3d , vzs ) if self ._depthshade else
600- self ._facecolor3d )
601- ecs = (_zalpha (self ._edgecolor3d , vzs ) if self ._depthshade else
602- self ._edgecolor3d )
603- sizes = self ._sizes3d
604- lws = self ._linewidth3d
584+ fcs = (_zalpha (self .get_facecolor () , vzs ) if self ._depthshade else
585+ self .get_facecolor () )
586+ ecs = (_zalpha (self .get_edgecolor () , vzs ) if self ._depthshade else
587+ self .get_edgecolor () )
588+ sizes = self .get_sizes ()
589+ lws = self .get_linewidth ()
605590
606591 # Sort the points based on z coordinates
607592 # Performance optimization: Create a sorted index array and reorder
@@ -625,14 +610,9 @@ def do_3d_projection(self, renderer=None):
625610 fcs = mcolors .to_rgba_array (fcs , self ._alpha )
626611 ecs = mcolors .to_rgba_array (ecs , self ._alpha )
627612
628- super ().set_edgecolor (ecs )
629- super ().set_facecolor (fcs )
630- super ().set_sizes (sizes )
631- super ().set_linewidth (lws )
632-
633- PathCollection .set_offsets (self , vps )
634-
635- return np .min (vzs ) if vzs .size else np .nan
613+ with cbook ._setattr_cm (self , _edgecolors = ecs , _facecolors = fcs ,
614+ _linewidths = lws , _offsets = vps , _sizes = sizes ):
615+ super ().draw (renderer )
636616
637617
638618def patch_collection_2d_to_3d (col , zs = 0 , zdir = 'z' , depthshade = True ):
0 commit comments