File tree Expand file tree Collapse file tree 4 files changed +8
-39
lines changed Expand file tree Collapse file tree 4 files changed +8
-39
lines changed Original file line number Diff line number Diff line change @@ -879,8 +879,10 @@ def set_alpha(self, alpha):
879
879
880
880
Parameters
881
881
----------
882
- alpha : float
882
+ alpha : float or None
883
883
"""
884
+ if alpha is not None and not isinstance (alpha , Number ):
885
+ raise TypeError ('alpha must be a float or None' )
884
886
self ._alpha = alpha
885
887
self .pchanged ()
886
888
self .stale = True
Original file line number Diff line number Diff line change @@ -728,20 +728,9 @@ def set_edgecolor(self, c):
728
728
self ._set_edgecolor (c )
729
729
730
730
def set_alpha (self , alpha ):
731
- """
732
- Set the alpha transparencies of the collection.
733
-
734
- Parameters
735
- ----------
736
- alpha : float or None
737
- """
738
- if alpha is not None :
739
- try :
740
- float (alpha )
741
- except TypeError :
742
- raise TypeError ('alpha must be a float or None' )
731
+ # docstring inherited
732
+ super ().set_alpha (alpha )
743
733
self .update_dict ['array' ] = True
744
- artist .Artist .set_alpha (self , alpha )
745
734
self ._set_facecolor (self ._original_facecolor )
746
735
self ._set_edgecolor (self ._original_edgecolor )
747
736
Original file line number Diff line number Diff line change @@ -328,19 +328,8 @@ def set_color(self, c):
328
328
self .set_edgecolor (c )
329
329
330
330
def set_alpha (self , alpha ):
331
- """
332
- Set the alpha transparency of the patch.
333
-
334
- Parameters
335
- ----------
336
- alpha : float or None
337
- """
338
- if alpha is not None :
339
- try :
340
- float (alpha )
341
- except TypeError :
342
- raise TypeError ('alpha must be a float or None' )
343
- artist .Artist .set_alpha (self , alpha )
331
+ # docstring inherited
332
+ super ().set_alpha (alpha )
344
333
self ._set_facecolor (self ._original_facecolor )
345
334
self ._set_edgecolor (self ._original_edgecolor )
346
335
# stale is already True
Original file line number Diff line number Diff line change @@ -744,18 +744,7 @@ def set_edgecolor(self, colors):
744
744
self ._edgecolors3d = PolyCollection .get_edgecolor (self )
745
745
746
746
def set_alpha (self , alpha ):
747
- """
748
- Set the alpha transparencies of the collection.
749
-
750
- Parameters
751
- ----------
752
- alpha : float or None
753
- """
754
- if alpha is not None :
755
- try :
756
- float (alpha )
757
- except TypeError :
758
- raise TypeError ('alpha must be a float or None' )
747
+ # docstring inherited
759
748
artist .Artist .set_alpha (self , alpha )
760
749
try :
761
750
self ._facecolors3d = mcolors .to_rgba_array (
You can’t perform that action at this time.
0 commit comments