Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit52fd461

Browse files
committed
Split attribute sorting into Patch3DCollection.draw.
This moves attribute sorting from `Patch3DCollection.do_3d_projection`into a new `draw` method. Sorted attributes are added only temporarily,so there is no reason to cache the original values anywhere, and thusall overridden setters can be dropped.
1 parent6293052 commit52fd461

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

‎lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -454,16 +454,6 @@ def set_depthshade(self, depthshade):
454454
self._depthshade=depthshade
455455
self.stale=True
456456

457-
defset_facecolor(self,c):
458-
# docstring inherited
459-
super().set_facecolor(c)
460-
self._facecolor3d=self.get_facecolor()
461-
462-
defset_edgecolor(self,c):
463-
# docstring inherited
464-
super().set_edgecolor(c)
465-
self._edgecolor3d=self.get_edgecolor()
466-
467457
defset_sort_zpos(self,val):
468458
"""Set the position to use for z-sorting."""
469459
self._sort_zpos=val
@@ -480,32 +470,39 @@ def set_3d_properties(self, zs, zdir):
480470
xs= []
481471
ys= []
482472
self._offsets3d=juggle_axes(xs,ys,np.atleast_1d(zs),zdir)
483-
self._facecolor3d=self.get_facecolor()
484-
self._edgecolor3d=self.get_edgecolor()
485473
self.stale=True
486474

487475
@cbook._delete_parameter('3.4','renderer')
488476
defdo_3d_projection(self,renderer=None):
489477
xs,ys,zs=self._offsets3d
490478
vxs,vys,vzs,vis=proj3d.proj_transform_clip(xs,ys,zs,
491479
self.axes.M)
492-
493-
fcs= (_zalpha(self._facecolor3d,vzs)ifself._depthshadeelse
494-
self._facecolor3d)
495-
fcs=mcolors.to_rgba_array(fcs,self._alpha)
496-
super().set_facecolor(fcs)
497-
498-
ecs= (_zalpha(self._edgecolor3d,vzs)ifself._depthshadeelse
499-
self._edgecolor3d)
500-
ecs=mcolors.to_rgba_array(ecs,self._alpha)
501-
super().set_edgecolor(ecs)
502-
super().set_offsets(np.column_stack([vxs,vys]))
503-
504480
ifvzs.size>0:
505481
returnmin(vzs)
506482
else:
507483
returnnp.nan
508484

485+
@artist.allow_rasterization
486+
defdraw(self,renderer):
487+
# docstring inherited
488+
xs,ys,zs=self._offsets3d
489+
vxs,vys,vzs,vis=proj3d.proj_transform_clip(xs,ys,zs,
490+
self.axes.M)
491+
492+
fcs=self.get_facecolor()
493+
ecs=self.get_edgecolor()
494+
ifself._depthshade:
495+
fcs=_zalpha(fcs,vzs)
496+
ecs=_zalpha(ecs,vzs)
497+
fcs=mcolors.to_rgba_array(fcs,self._alpha)
498+
ecs=mcolors.to_rgba_array(ecs,self._alpha)
499+
500+
offsets=np.column_stack([vxs,vys])
501+
502+
withcbook._setattr_cm(self,_edgecolors=ecs,_facecolors=fcs,
503+
_offsets=offsets):
504+
super().draw(renderer)
505+
509506

510507
classPath3DCollection(PathCollection):
511508
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp