15
15
16
16
from matplotlib import (
17
17
_api , artist , cbook , colors as mcolors , lines , text as mtext ,
18
- path as mpath )
18
+ path as mpath , rcParams )
19
19
from matplotlib .collections import (
20
20
Collection , LineCollection , PolyCollection , PatchCollection , PathCollection )
21
21
from matplotlib .patches import Patch
@@ -647,8 +647,8 @@ def __init__(
647
647
* args ,
648
648
zs = 0 ,
649
649
zdir = "z" ,
650
- depthshade = True ,
651
- depthshade_minalpha = 0.3 ,
650
+ depthshade = None ,
651
+ depthshade_minalpha = None ,
652
652
axlim_clip = False ,
653
653
** kwargs
654
654
):
@@ -670,6 +670,10 @@ def __init__(
670
670
*depthshade_minalpha* sets the minimum alpha value applied by
671
671
depth-shading.
672
672
"""
673
+ if depthshade is None :
674
+ depthshade = rcParams ['axes3d.depthshade' ]
675
+ if depthshade_minalpha is None :
676
+ depthshade_minalpha = rcParams ['axes3d.depthshade_minalpha' ]
673
677
self ._depthshade = depthshade
674
678
self ._depthshade_minalpha = depthshade_minalpha
675
679
super ().__init__ (* args , ** kwargs )
@@ -681,7 +685,7 @@ def get_depthshade(self):
681
685
def set_depthshade (
682
686
self ,
683
687
depthshade ,
684
- depthshade_minalpha = 0.3 ,
688
+ depthshade_minalpha = None ,
685
689
):
686
690
"""
687
691
Set whether depth shading is performed on collection members.
@@ -691,9 +695,12 @@ def set_depthshade(
691
695
depthshade : bool
692
696
Whether to shade the patches in order to give the appearance of
693
697
depth.
694
- depthshade_minalpha : float
698
+ depthshade_minalpha : float, default: None
695
699
Sets the minimum alpha value used by depth-shading.
700
+ If None, use the value from rcParams['axes3d.depthshade_minalpha'].
696
701
"""
702
+ if depthshade_minalpha is None :
703
+ depthshade_minalpha = rcParams ['axes3d.depthshade_minalpha' ]
697
704
self ._depthshade = depthshade
698
705
self ._depthshade_minalpha = depthshade_minalpha
699
706
self .stale = True
@@ -813,8 +820,8 @@ def __init__(
813
820
* args ,
814
821
zs = 0 ,
815
822
zdir = "z" ,
816
- depthshade = True ,
817
- depthshade_minalpha = 0.3 ,
823
+ depthshade = None ,
824
+ depthshade_minalpha = None ,
818
825
axlim_clip = False ,
819
826
** kwargs
820
827
):
@@ -836,6 +843,10 @@ def __init__(
836
843
*depthshade_minalpha* sets the minimum alpha value applied by
837
844
depth-shading.
838
845
"""
846
+ if depthshade is None :
847
+ depthshade = rcParams ['axes3d.depthshade' ]
848
+ if depthshade_minalpha is None :
849
+ depthshade_minalpha = rcParams ['axes3d.depthshade_minalpha' ]
839
850
self ._depthshade = depthshade
840
851
self ._depthshade_minalpha = depthshade_minalpha
841
852
self ._in_draw = False
@@ -919,7 +930,7 @@ def get_depthshade(self):
919
930
def set_depthshade (
920
931
self ,
921
932
depthshade ,
922
- depthshade_minalpha = 0.3 ,
933
+ depthshade_minalpha = None ,
923
934
):
924
935
"""
925
936
Set whether depth shading is performed on collection members.
@@ -932,6 +943,8 @@ def set_depthshade(
932
943
depthshade_minalpha : float
933
944
Sets the minimum alpha value used by depth-shading.
934
945
"""
946
+ if depthshade_minalpha is None :
947
+ depthshade_minalpha = rcParams ['axes3d.depthshade_minalpha' ]
935
948
self ._depthshade = depthshade
936
949
self ._depthshade_minalpha = depthshade_minalpha
937
950
self .stale = True
@@ -1029,10 +1042,10 @@ def patch_collection_2d_to_3d(
1029
1042
col ,
1030
1043
zs = 0 ,
1031
1044
zdir = "z" ,
1032
- depthshade = True ,
1045
+ depthshade = None ,
1033
1046
axlim_clip = False ,
1034
1047
* args ,
1035
- depthshade_minalpha = 0.3
1048
+ depthshade_minalpha = None ,
1036
1049
):
1037
1050
"""
1038
1051
Convert a `.PatchCollection` into a `.Patch3DCollection` object
@@ -1049,10 +1062,12 @@ def patch_collection_2d_to_3d(
1049
1062
zdir : {'x', 'y', 'z'}
1050
1063
The axis in which to place the patches. Default: "z".
1051
1064
See `.get_dir_vector` for a description of the values.
1052
- depthshade
1053
- Whether to shade the patches to give a sense of depth. Default: *True*.
1054
- depthshade_minalpha
1055
- Sets the minimum alpha value used by depth-shading. Default: 0.3.
1065
+ depthshade : bool, default: None
1066
+ Whether to shade the patches to give a sense of depth.
1067
+ If None, use the value from rcParams['axes3d.depthshade'].
1068
+ depthshade_minalpha : float, default: None
1069
+ Sets the minimum alpha value used by depth-shading.
1070
+ If None, use the value from rcParams['axes3d.depthshade_minalpha'].
1056
1071
axlim_clip : bool, default: False
1057
1072
Whether to hide patches with a vertex outside the axes view limits.
1058
1073
"""
@@ -1061,6 +1076,10 @@ def patch_collection_2d_to_3d(
1061
1076
col ._offset_zordered = None
1062
1077
elif isinstance (col , PatchCollection ):
1063
1078
col .__class__ = Patch3DCollection
1079
+ if depthshade is None :
1080
+ depthshade = rcParams ['axes3d.depthshade' ]
1081
+ if depthshade_minalpha is None :
1082
+ depthshade_minalpha = rcParams ['axes3d.depthshade_minalpha' ]
1064
1083
col ._depthshade = depthshade
1065
1084
col ._depthshade_minalpha = depthshade_minalpha
1066
1085
col ._in_draw = False
0 commit comments