Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 62dfcfd

Browse files
authored
Merge pull request #22337 from timhoffm/doc-Axes2
DOC: More cleanup axes -> Axes
2 parents f0593a6 + f156db0 commit 62dfcfd

File tree

5 files changed

+54
-56
lines changed

5 files changed

+54
-56
lines changed

lib/matplotlib/animation.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,11 +1161,11 @@ def _blit_draw(self, artists):
11611161
# Handles blitted drawing, which renders only the artists given instead
11621162
# of the entire figure.
11631163
updated_ax = {a.axes for a in artists}
1164-
# Enumerate artists to cache axes' backgrounds. We do not draw
1164+
# Enumerate artists to cache Axes backgrounds. We do not draw
11651165
# artists yet to not cache foreground from plots with shared axes
11661166
for ax in updated_ax:
11671167
# If we haven't cached the background for the current view of this
1168-
# axes object, do so now. This might not always be reliable, but
1168+
# Axes object, do so now. This might not always be reliable, but
11691169
# it's an attempt to automate the process.
11701170
cur_view = ax._get_view()
11711171
view, bg = self._blit_cache.get(ax, (object(), None))
@@ -1175,12 +1175,12 @@ def _blit_draw(self, artists):
11751175
# Make a separate pass to draw foreground.
11761176
for a in artists:
11771177
a.axes.draw_artist(a)
1178-
# After rendering all the needed artists, blit each axes individually.
1178+
# After rendering all the needed artists, blit each Axes individually.
11791179
for ax in updated_ax:
11801180
ax.figure.canvas.blit(ax.bbox)
11811181

11821182
def _blit_clear(self, artists):
1183-
# Get a list of the axes that need clearing from the artists that
1183+
# Get a list of the Axes that need clearing from the artists that
11841184
# have been drawn. Grab the appropriate saved background from the
11851185
# cache and restore.
11861186
axes = {a.axes for a in artists}
@@ -1195,8 +1195,7 @@ def _blit_clear(self, artists):
11951195
self._blit_cache.pop(ax)
11961196

11971197
def _setup_blit(self):
1198-
# Setting up the blit requires: a cache of the background for the
1199-
# axes
1198+
# Setting up the blit requires: a cache of the background for the Axes
12001199
self._blit_cache = dict()
12011200
self._drawn_artists = []
12021201
self._resize_id = self._fig.canvas.mpl_connect('resize_event',

lib/matplotlib/artist.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,8 @@ def remove(self):
215215
if hasattr(self, 'axes') and self.axes:
216216
# remove from the mouse hit list
217217
self.axes._mouseover_set.discard(self)
218-
# mark the axes as stale
219218
self.axes.stale = True
220-
# decouple the artist from the axes
221-
self.axes = None
219+
self.axes = None # decouple the artist from the Axes
222220
_ax_flag = True
223221

224222
if self.figure:
@@ -511,14 +509,14 @@ def pick(self, mouseevent):
511509

512510
# Pick children
513511
for a in self.get_children():
514-
# make sure the event happened in the same axes
512+
# make sure the event happened in the same Axes
515513
ax = getattr(a, 'axes', None)
516514
if (mouseevent.inaxes is None or ax is None
517515
or mouseevent.inaxes == ax):
518516
# we need to check if mouseevent.inaxes is None
519517
# because some objects associated with an Axes (e.g., a
520518
# tick label) can be outside the bounding box of the
521-
# axes and inaxes will be None
519+
# Axes and inaxes will be None
522520
# also check that ax is None so that it traverse objects
523521
# which do no have an axes property but children might
524522
a.pick(mouseevent)
@@ -829,7 +827,7 @@ def get_in_layout(self):
829827

830828
def _fully_clipped_to_axes(self):
831829
"""
832-
Return a boolean flag, ``True`` if the artist is clipped to the axes
830+
Return a boolean flag, ``True`` if the artist is clipped to the Axes
833831
and can thus be skipped in layout calculations. Requires `get_clip_on`
834832
is True, one of `clip_box` or `clip_path` is set, ``clip_box.extents``
835833
is equivalent to ``ax.bbox.extents`` (if set), and ``clip_path._patch``
@@ -877,7 +875,7 @@ def set_clip_on(self, b):
877875
"""
878876
Set whether the artist uses clipping.
879877
880-
When False artists will be visible outside of the axes which
878+
When False artists will be visible outside of the Axes which
881879
can lead to unexpected results.
882880
883881
Parameters

lib/matplotlib/axes/_base.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class _TransformedBoundsLocator:
9999
Axes locator for `.Axes.inset_axes` and similarly positioned Axes.
100100
101101
The locator is a callable object used in `.Axes.set_aspect` to compute the
102-
axes location depending on the renderer.
102+
Axes location depending on the renderer.
103103
"""
104104

105105
def __init__(self, bounds, transform):
@@ -1117,7 +1117,7 @@ def _gen_axes_patch(self):
11171117
The patch used to draw the background of the Axes. It is also used
11181118
as the clipping path for any data elements on the Axes.
11191119
1120-
In the standard axes, this is a rectangle, but in other projections
1120+
In the standard Axes, this is a rectangle, but in other projections
11211121
it may not be.
11221122
11231123
Notes
@@ -1149,7 +1149,7 @@ def sharex(self, other):
11491149
Share the x-axis with *other*.
11501150
11511151
This is equivalent to passing ``sharex=other`` when constructing the
1152-
axes, and cannot be used if the x-axis is already being shared with
1152+
Axes, and cannot be used if the x-axis is already being shared with
11531153
another Axes.
11541154
"""
11551155
_api.check_isinstance(_AxesBase, other=other)
@@ -1168,7 +1168,7 @@ def sharey(self, other):
11681168
Share the y-axis with *other*.
11691169
11701170
This is equivalent to passing ``sharey=other`` when constructing the
1171-
axes, and cannot be used if the y-axis is already being shared with
1171+
Axes, and cannot be used if the y-axis is already being shared with
11721172
another Axes.
11731173
"""
11741174
_api.check_isinstance(_AxesBase, other=other)
@@ -2413,7 +2413,7 @@ def add_table(self, tab):
24132413

24142414
def add_container(self, container):
24152415
"""
2416-
Add a `.Container` to the axes' containers; return the container.
2416+
Add a `.Container` to the Axes' containers; return the container.
24172417
"""
24182418
label = container.get_label()
24192419
if not label:
@@ -2499,8 +2499,8 @@ def _process_unit_info(self, datasets=None, kwargs=None, *, convert=True):
24992499
(which gets passed through).
25002500
kwargs : dict
25012501
Other parameters from which unit info (i.e., the *xunits*,
2502-
*yunits*, *zunits* (for 3D axes), *runits* and *thetaunits* (for
2503-
polar axes) entries) is popped, if present. Note that this dict is
2502+
*yunits*, *zunits* (for 3D Axes), *runits* and *thetaunits* (for
2503+
polar) entries) is popped, if present. Note that this dict is
25042504
mutated in-place!
25052505
convert : bool, default: True
25062506
Whether to return the original datasets or the converted ones.
@@ -2779,7 +2779,7 @@ def autoscale(self, enable=True, axis='both', tight=None):
27792779
True turns autoscaling on, False turns it off.
27802780
None leaves the autoscaling state unchanged.
27812781
axis : {'both', 'x', 'y'}, default: 'both'
2782-
The axis on which to operate. (For 3D axes, *axis* can also be set
2782+
The axis on which to operate. (For 3D Axes, *axis* can also be set
27832783
to 'z', and 'both' refers to all three axes.)
27842784
tight : bool or None, default: None
27852785
If True, first set the margins to zero. Then, this argument is
@@ -2853,7 +2853,7 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
28532853
if self.use_sticky_edges:
28542854
# Only iterate over Axes and artists if needed. The check for
28552855
# ``hasattr(ax, "_children")`` is necessary because this can be
2856-
# called very early in the Axes init process (e.g., for twin axes)
2856+
# called very early in the Axes init process (e.g., for twin Axes)
28572857
# when these attributes don't even exist yet, in which case
28582858
# `get_children` would raise an AttributeError.
28592859
if self._xmargin and scalex and self._autoscaleXon:
@@ -2953,7 +2953,7 @@ def _get_axis_map(self):
29532953
Return a mapping of `Axis` "names" to `Axis` instances.
29542954
29552955
The `Axis` name is derived from the attribute under which the instance
2956-
is stored, so e.g. for polar axes, the theta-axis is still named "x"
2956+
is stored, so e.g. for polar Axes, the theta-axis is still named "x"
29572957
and the r-axis is still named "y" (for back-compatibility).
29582958
29592959
In practice, this means that the entries are typically "x" and "y", and
@@ -3245,7 +3245,7 @@ def grid(self, visible=None, which='major', axis='both', **kwargs):
32453245
def ticklabel_format(self, *, axis='both', style='', scilimits=None,
32463246
useOffset=None, useLocale=None, useMathText=None):
32473247
r"""
3248-
Configure the `.ScalarFormatter` used by default for linear axes.
3248+
Configure the `.ScalarFormatter` used by default for linear Axes.
32493249
32503250
If a parameter is not set, the corresponding property of the formatter
32513251
is left unchanged.
@@ -3327,7 +3327,7 @@ def locator_params(self, axis='both', tight=None, **kwargs):
33273327
Parameters
33283328
----------
33293329
axis : {'both', 'x', 'y'}, default: 'both'
3330-
The axis on which to operate. (For 3D axes, *axis* can also be
3330+
The axis on which to operate. (For 3D Axes, *axis* can also be
33313331
set to 'z', and 'both' refers to all three axes.)
33323332
tight : bool or None, optional
33333333
Parameter passed to `~.Axes.autoscale_view`.
@@ -3340,7 +3340,7 @@ def locator_params(self, axis='both', tight=None, **kwargs):
33403340
``set_params()`` method of the locator. Supported keywords depend
33413341
on the type of the locator. See for example
33423342
`~.ticker.MaxNLocator.set_params` for the `.ticker.MaxNLocator`
3343-
used by default for linear axes.
3343+
used by default for linear.
33443344
33453345
Examples
33463346
--------
@@ -3377,7 +3377,7 @@ def tick_params(self, axis='both', **kwargs):
33773377
Other Parameters
33783378
----------------
33793379
direction : {'in', 'out', 'inout'}
3380-
Puts ticks inside the axes, outside the axes, or both.
3380+
Puts ticks inside the Axes, outside the Axes, or both.
33813381
length : float
33823382
Tick length in points.
33833383
width : float
@@ -4538,7 +4538,7 @@ def contains(self, mouseevent):
45384538

45394539
def contains_point(self, point):
45404540
"""
4541-
Return whether *point* (pair of pixel coordinates) is inside the axes
4541+
Return whether *point* (pair of pixel coordinates) is inside the Axes
45424542
patch.
45434543
"""
45444544
return self.patch.contains_point(point, radius=1.0)
@@ -4568,7 +4568,7 @@ def get_default_bbox_extra_artists(self):
45684568
artists.remove(self._right_title)
45694569

45704570
# always include types that do not internally implement clipping
4571-
# to axes. may have clip_on set to True and clip_box equivalent
4571+
# to Axes. may have clip_on set to True and clip_box equivalent
45724572
# to ax.bbox but then ignore these properties during draws.
45734573
noclip = (_AxesBase, maxis.Axis,
45744574
offsetbox.AnnotationBbox, offsetbox.OffsetBox)
@@ -4578,7 +4578,7 @@ def get_default_bbox_extra_artists(self):
45784578
def get_tightbbox(self, renderer, call_axes_locator=True,
45794579
bbox_extra_artists=None, *, for_layout_only=False):
45804580
"""
4581-
Return the tight bounding box of the axes, including axis and their
4581+
Return the tight bounding box of the Axes, including axis and their
45824582
decorators (xlabel, title, etc).
45834583
45844584
Artists that have ``artist.set_in_layout(False)`` are not included

lib/matplotlib/axis.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def get_tickdir(self):
220220
return self._tickdir
221221

222222
def get_tick_padding(self):
223-
"""Get the length of the tick outside of the axes."""
223+
"""Get the length of the tick outside of the Axes."""
224224
padding = {
225225
'in': 0.0,
226226
'inout': 0.5,
@@ -1869,7 +1869,7 @@ def _get_tick_boxes_siblings(self, renderer):
18691869
grouper = self.figure._align_label_groups[axis_name]
18701870
bboxes = []
18711871
bboxes2 = []
1872-
# If we want to align labels from other axes:
1872+
# If we want to align labels from other Axes:
18731873
for ax in grouper.get_siblings(self.axes):
18741874
axis = getattr(ax, f"{axis_name}axis")
18751875
ticks_to_draw = axis._update_ticks()
@@ -2083,7 +2083,7 @@ def _update_label_position(self, renderer):
20832083
spine = self.axes.spines['bottom']
20842084
spinebbox = spine.get_window_extent()
20852085
except KeyError:
2086-
# use axes if spine doesn't exist
2086+
# use Axes if spine doesn't exist
20872087
spinebbox = self.axes.bbox
20882088
bbox = mtransforms.Bbox.union(bboxes + [spinebbox])
20892089
bottom = bbox.y0
@@ -2096,7 +2096,7 @@ def _update_label_position(self, renderer):
20962096
spine = self.axes.spines['top']
20972097
spinebbox = spine.get_window_extent()
20982098
except KeyError:
2099-
# use axes if spine doesn't exist
2099+
# use Axes if spine doesn't exist
21002100
spinebbox = self.axes.bbox
21012101
bbox = mtransforms.Bbox.union(bboxes2 + [spinebbox])
21022102
top = bbox.y1
@@ -2132,7 +2132,7 @@ def _update_offset_text_position(self, bboxes, bboxes2):
21322132
def get_text_heights(self, renderer):
21332133
"""
21342134
Return how much space should be reserved for text above and below the
2135-
axes, as a pair of floats.
2135+
Axes, as a pair of floats.
21362136
"""
21372137
bbox, bbox2 = self.get_ticklabel_extents(renderer)
21382138
# MGDTODO: Need a better way to get the pad
@@ -2193,7 +2193,7 @@ def set_ticks_position(self, position):
21932193

21942194
def tick_top(self):
21952195
"""
2196-
Move ticks and ticklabels (if present) to the top of the axes.
2196+
Move ticks and ticklabels (if present) to the top of the Axes.
21972197
"""
21982198
label = True
21992199
if 'label1On' in self._major_tick_kw:
@@ -2205,7 +2205,7 @@ def tick_top(self):
22052205

22062206
def tick_bottom(self):
22072207
"""
2208-
Move ticks and ticklabels (if present) to the bottom of the axes.
2208+
Move ticks and ticklabels (if present) to the bottom of the Axes.
22092209
"""
22102210
label = True
22112211
if 'label1On' in self._major_tick_kw:
@@ -2347,7 +2347,7 @@ def _update_label_position(self, renderer):
23472347
spine = self.axes.spines['left']
23482348
spinebbox = spine.get_window_extent()
23492349
except KeyError:
2350-
# use axes if spine doesn't exist
2350+
# use Axes if spine doesn't exist
23512351
spinebbox = self.axes.bbox
23522352
bbox = mtransforms.Bbox.union(bboxes + [spinebbox])
23532353
left = bbox.x0
@@ -2360,7 +2360,7 @@ def _update_label_position(self, renderer):
23602360
spine = self.axes.spines['right']
23612361
spinebbox = spine.get_window_extent()
23622362
except KeyError:
2363-
# use axes if spine doesn't exist
2363+
# use Axes if spine doesn't exist
23642364
spinebbox = self.axes.bbox
23652365

23662366
bbox = mtransforms.Bbox.union(bboxes2 + [spinebbox])
@@ -2449,7 +2449,7 @@ def set_ticks_position(self, position):
24492449

24502450
def tick_right(self):
24512451
"""
2452-
Move ticks and ticklabels (if present) to the right of the axes.
2452+
Move ticks and ticklabels (if present) to the right of the Axes.
24532453
"""
24542454
label = True
24552455
if 'label1On' in self._major_tick_kw:
@@ -2462,7 +2462,7 @@ def tick_right(self):
24622462

24632463
def tick_left(self):
24642464
"""
2465-
Move ticks and ticklabels (if present) to the left of the axes.
2465+
Move ticks and ticklabels (if present) to the left of the Axes.
24662466
"""
24672467
label = True
24682468
if 'label1On' in self._major_tick_kw:

0 commit comments

Comments
 (0)