@@ -854,36 +854,44 @@ def _update_transScale(self):
854
854
pass
855
855
856
856
def get_position (self , original = False ):
857
- 'Return the a copy of the axes rectangle as a Bbox'
857
+ """
858
+ Get a copy of the axes rectangle as a `.Bbox`.
859
+
860
+ Parameters
861
+ ----------
862
+ original : bool
863
+ If ``True``, return the original position. Otherwise return the
864
+ active position. For an explanation of the positions see
865
+ `.set_position`.
866
+
867
+ Returns
868
+ -------
869
+ pos : `.Bbox`
870
+
871
+ """
858
872
if original :
859
873
return self ._originalPosition .frozen ()
860
874
else :
861
875
return self ._position .frozen ()
862
876
863
877
def set_position (self , pos , which = 'both' ):
864
- """Set the axes position
865
-
866
- The expected shape of ``pos`` is::
878
+ """
879
+ Set the axes position.
867
880
868
- pos = [left, bottom, width, height]
881
+ Axes have two position attributes. The 'original' position is the
882
+ position allocated for the Axes. The 'active' position is the
883
+ position the Axes is actually drawn at. These positions are usually
884
+ the same unless a fixed aspect is set to the Axes. See `.set_aspect`
885
+ for details.
869
886
870
- in relative 0,1 coords, or *pos* can be a
871
- :class:`~matplotlib.transforms.Bbox`
887
+ Parameters
888
+ ----------
889
+ pos : [left, bottom, width, height] or `~matplotlib.transforms.Bbox`
890
+ The new position of the in `.Figure` coordinates.
872
891
873
- There are two position variables: one which is ultimately
874
- used, but which may be modified by :meth:`apply_aspect`, and a
875
- second which is the starting point for :meth:`apply_aspect`.
892
+ which : ['both' | 'active' | 'original'], optional
893
+ Determines which position variables to change.
876
894
877
- Optional keyword arguments:
878
- *which*
879
-
880
- ========== ====================
881
- value description
882
- ========== ====================
883
- 'active' to change the first
884
- 'original' to change the second
885
- 'both' to change both
886
- ========== ====================
887
895
"""
888
896
if not isinstance (pos , mtransforms .BboxBase ):
889
897
pos = mtransforms .Bbox .from_bounds (* pos )
@@ -894,7 +902,12 @@ def set_position(self, pos, which='both'):
894
902
self .stale = True
895
903
896
904
def reset_position (self ):
897
- """Make the original position the active position"""
905
+ """
906
+ Reset the active position to the original position.
907
+
908
+ This resets the a possible position change due to aspect constraints.
909
+ For an explanation of the positions see `.set_position`.
910
+ """
898
911
pos = self .get_position (original = True )
899
912
self .set_position (pos , which = 'active' )
900
913
@@ -917,7 +930,7 @@ def set_axes_locator(self, locator):
917
930
918
931
def get_axes_locator (self ):
919
932
"""
920
- return axes_locator
933
+ Return the axes_locator.
921
934
"""
922
935
return self ._axes_locator
923
936
@@ -1114,10 +1127,11 @@ def axesPatch(self):
1114
1127
return self .patch
1115
1128
1116
1129
def clear (self ):
1117
- """clear the axes"""
1130
+ """Clear the axes. """
1118
1131
self .cla ()
1119
1132
1120
1133
def get_facecolor (self ):
1134
+ """Get the Axes facecolor."""
1121
1135
return self .patch .get_facecolor ()
1122
1136
get_fc = get_facecolor
1123
1137
@@ -1226,7 +1240,7 @@ def ishold(self):
1226
1240
@cbook .deprecated ("2.0" , message = _hold_msg )
1227
1241
def hold (self , b = None ):
1228
1242
"""
1229
- Set the hold state
1243
+ Set the hold state.
1230
1244
1231
1245
The ``hold`` mechanism is deprecated and will be removed in
1232
1246
v3.0. The behavior will remain consistent with the
0 commit comments