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

Skip to content

DOC: More capitalization of Axes #22249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/axes_grid1/demo_colorbar_with_axes_divider.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@

im1 = ax1.imshow([[1, 2], [3, 4]])
ax1_divider = make_axes_locatable(ax1)
# Add an axes to the right of the main axes.
# Add an Axes to the right of the main Axes.
cax1 = ax1_divider.append_axes("right", size="7%", pad="2%")
cb1 = fig.colorbar(im1, cax=cax1)

im2 = ax2.imshow([[1, 2], [3, 4]])
ax2_divider = make_axes_locatable(ax2)
# Add an axes above the main axes.
# Add an Axes above the main Axes.
cax2 = ax2_divider.append_axes("top", size="7%", pad="2%")
cb2 = fig.colorbar(im2, cax=cax2, orientation="horizontal")
# Change tick position to top (with the default tick position "bottom", ticks
Expand Down
2 changes: 1 addition & 1 deletion examples/axes_grid1/simple_axes_divider1.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


def label_axes(ax, text):
"""Place a label at the center of an axes, and remove the axis ticks."""
"""Place a label at the center of an Axes, and remove the axis ticks."""
ax.text(.5, .5, text, transform=ax.transAxes,
horizontalalignment="center", verticalalignment="center")
ax.tick_params(bottom=False, labelbottom=False,
Expand Down
2 changes: 1 addition & 1 deletion examples/axes_grid1/simple_colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
ax = plt.subplot()
im = ax.imshow(np.arange(100).reshape((10, 10)))

# create an axes on the right side of ax. The width of cax will be 5%
# create an Axes on the right side of ax. The width of cax will be 5%
# of ax and the padding between cax and ax will be fixed at 0.05 inch.
divider = make_axes_locatable(ax)
cax = divider.append_axes("right", size="5%", pad=0.05)
Expand Down
2 changes: 1 addition & 1 deletion examples/lines_bars_and_markers/fill_between_alpha.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@

###############################################################################
# Another handy use of filled regions is to highlight horizontal or vertical
# spans of an axes -- for that Matplotlib has the helper functions
# spans of an Axes -- for that Matplotlib has the helper functions
# `~matplotlib.axes.Axes.axhspan` and `~matplotlib.axes.Axes.axvspan`. See
# :doc:`/gallery/subplots_axes_and_figures/axhspan_demo`.

Expand Down
2 changes: 1 addition & 1 deletion examples/lines_bars_and_markers/gradient_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
by a unit vector *v*. The values at the corners are then obtained by the
lengths of the projections of the corner vectors on *v*.

A similar approach can be used to create a gradient background for an axes.
A similar approach can be used to create a gradient background for an Axes.
In that case, it is helpful to uses Axes coordinates (``extent=(0, 1, 0, 1),
transform=ax.transAxes``) to be independent of the data coordinates.

Expand Down
2 changes: 1 addition & 1 deletion examples/misc/logos2.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def create_icon_axes(fig, ax_position, lw_bars, lw_grid, lw_border, rgrid):


def create_text_axes(fig, height_px):
"""Create an axes in *fig* that contains 'matplotlib' as Text."""
"""Create an Axes in *fig* that contains 'matplotlib' as Text."""
ax = fig.add_axes((0, 0, 1, 1))
ax.set_aspect("equal")
ax.set_axis_off()
Expand Down
6 changes: 3 additions & 3 deletions examples/spines/spines.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

This demo compares:

- normal axes, with spines on all four sides;
- an axes with spines only on the left and bottom;
- an axes using custom bounds to limit the extent of the spine.
- normal Axes, with spines on all four sides;
- an Axes with spines only on the left and bottom;
- an Axes using custom bounds to limit the extent of the spine.
"""
import numpy as np
import matplotlib.pyplot as plt
Expand Down
8 changes: 4 additions & 4 deletions examples/subplots_axes_and_figures/axes_box_aspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Axes box aspect
===============

This demo shows how to set the aspect of an axes box directly via
This demo shows how to set the aspect of an Axes box directly via
`~.Axes.set_box_aspect`. The box aspect is the ratio between axes height
and axes width in physical units, independent of the data limits.
This is useful to e.g. produce a square plot, independent of the data it
Expand Down Expand Up @@ -119,7 +119,7 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# When setting the box aspect, one may still set the data aspect as well.
# Here we create an axes with a box twice as long as tall and use an "equal"
# Here we create an Axes with a box twice as long as tall and use an "equal"
# data aspect for its contents, i.e. the circle actually stays circular.

fig6, ax = plt.subplots()
Expand All @@ -135,8 +135,8 @@
# Box aspect for many subplots
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# It is possible to pass the box aspect to an axes at initialization. The
# following creates a 2 by 3 subplot grid with all square axes.
# It is possible to pass the box aspect to an Axes at initialization. The
# following creates a 2 by 3 subplot grid with all square Axes.

fig7, axs = plt.subplots(2, 3, subplot_kw=dict(box_aspect=1),
sharex=True, sharey=True, constrained_layout=True)
Expand Down
10 changes: 5 additions & 5 deletions examples/subplots_axes_and_figures/shared_axis_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
===========

You can share the x or y axis limits for one axis with another by
passing an axes instance as a *sharex* or *sharey* keyword argument.
passing an `~.axes.Axes` instance as a *sharex* or *sharey* keyword argument.

Changing the axis limits on one axes will be reflected automatically
in the other, and vice-versa, so when you navigate with the toolbar
the axes will follow each other on their shared axes. Ditto for
the Axes will follow each other on their shared axis. Ditto for
changes in the axis scaling (e.g., log vs. linear). However, it is
possible to have differences in tick labeling, e.g., you can selectively
turn off the tick labels on one axes.
turn off the tick labels on one Axes.

The example below shows how to customize the tick labels on the
various axes. Shared axes share the tick locator, tick formatter,
Expand All @@ -20,13 +20,13 @@
because you may want to make the tick labels smaller on the upper
axes, e.g., in the example below.

If you want to turn off the ticklabels for a given axes (e.g., on
If you want to turn off the ticklabels for a given Axes (e.g., on
subplot(211) or subplot(212), you cannot do the standard trick::

setp(ax2, xticklabels=[])

because this changes the tick Formatter, which is shared among all
axes. But you can alter the visibility of the labels, which is a
Axes. But you can alter the visibility of the labels, which is a
property::

setp(ax2.get_xticklabels(), visible=False)
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/_constrained_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
often just set to 1 for an equal grid.

Subplotspecs that are derived from this gridspec can contain either a
``SubPanel``, a ``GridSpecFromSubplotSpec``, or an axes. The ``SubPanel`` and
``GridSpecFromSubplotSpec`` are dealt with recursively and each contain an
``SubPanel``, a ``GridSpecFromSubplotSpec``, or an ``Axes``. The ``SubPanel``
and ``GridSpecFromSubplotSpec`` are dealt with recursively and each contain an
analogous layout.

Each ``GridSpec`` has a ``_layoutgrid`` attached to it. The ``_layoutgrid``
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def __init__(self):
def __getstate__(self):
d = self.__dict__.copy()
# remove the unpicklable remove method, this will get re-added on load
# (by the axes) if the artist lives on an axes.
# (by the Axes) if the artist lives on an Axes.
d['stale_callback'] = None
return d

Expand Down Expand Up @@ -516,7 +516,7 @@ def pick(self, mouseevent):
if (mouseevent.inaxes is None or ax is None
or mouseevent.inaxes == ax):
# we need to check if mouseevent.inaxes is None
# because some objects associated with an axes (e.g., a
# because some objects associated with an Axes (e.g., a
# tick label) can be outside the bounding box of the
# axes and inaxes will be None
# also check that ax is None so that it traverse objects
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2491,7 +2491,7 @@ def key_press_handler(event, canvas=None, toolbar=None):
back-compatibility, but, if set, should always be equal to
``event.canvas.toolbar``.
"""
# these bindings happen whether you are over an axes or not
# these bindings happen whether you are over an Axes or not

if event.key is None:
return
Expand Down Expand Up @@ -2554,7 +2554,7 @@ def key_press_handler(event, canvas=None, toolbar=None):
if event.inaxes is None:
return

# these bindings require the mouse to be over an axes to trigger
# these bindings require the mouse to be over an Axes to trigger
def _get_uniform_gridstate(ticks):
# Return True/False if all grid lines are on or off, None if they are
# not all in the same state.
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class FigureBase(Artist):
def __init__(self, **kwargs):
super().__init__()
# remove the non-figure artist _axes property
# as it makes no sense for a figure to be _in_ an axes
# as it makes no sense for a figure to be _in_ an Axes
# this is used by the property methods in the artist base class
# which are over-ridden in this class
del self._axes
Expand Down Expand Up @@ -1879,7 +1879,7 @@ def _do_layout(gs, mosaic, unique_ids, nested):
name, arg, method = this_level[key]
# we are doing some hokey function dispatch here based
# on the 'method' string stashed above to sort out if this
# element is an axes or a nested mosaic.
# element is an Axes or a nested mosaic.
if method == 'axes':
slc = arg
# add a single axes
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/projections/polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ def set_thetalim(self, *args, **kwargs):
where minval and maxval are the minimum and maximum limits. Values are
wrapped in to the range :math:`[0, 2\pi]` (in radians), so for example
it is possible to do ``set_thetalim(-np.pi / 2, np.pi / 2)`` to have
an axes symmetric around 0. A ValueError is raised if the absolute
an axis symmetric around 0. A ValueError is raised if the absolute
angle difference is larger than a full circle.
"""
orig_lim = self.get_xlim() # in radians
Expand Down
32 changes: 16 additions & 16 deletions lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
pyplot is still usually used to create the figure and often the axes in the
figure. See `.pyplot.figure`, `.pyplot.subplots`, and
`.pyplot.subplot_mosaic` to create figures, and
:doc:`Axes API <../axes_api>` for the plotting methods on an axes::
:doc:`Axes API <../axes_api>` for the plotting methods on an Axes::

import numpy as np
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -979,7 +979,7 @@ def figlegend(*args, **kwargs):
@docstring.dedent_interpd
def axes(arg=None, **kwargs):
"""
Add an axes to the current figure and make it the current axes.
Add an Axes to the current figure and make it the current Axes.

Call signatures::

Expand All @@ -992,10 +992,10 @@ def axes(arg=None, **kwargs):
arg : None or 4-tuple
The exact behavior of this function depends on the type:

- *None*: A new full window axes is added using
- *None*: A new full window Axes is added using
``subplot(**kwargs)``.
- 4-tuple of floats *rect* = ``[left, bottom, width, height]``.
A new axes is added with dimensions *rect* in normalized
A new Axes is added with dimensions *rect* in normalized
(0, 1) units using `~.Figure.add_axes` on the current figure.

projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', \
Expand All @@ -1010,10 +1010,10 @@ def axes(arg=None, **kwargs):
sharex, sharey : `~.axes.Axes`, optional
Share the x or y `~matplotlib.axis` with sharex and/or sharey.
The axis will have the same limits, ticks, and scale as the axis
of the shared axes.
of the shared Axes.

label : str
A label for the returned axes.
A label for the returned Axes.

Returns
-------
Expand All @@ -1026,23 +1026,23 @@ def axes(arg=None, **kwargs):
----------------
**kwargs
This method also takes the keyword arguments for
the returned axes class. The keyword arguments for the
rectilinear axes class `~.axes.Axes` can be found in
the returned Axes class. The keyword arguments for the
rectilinear Axes class `~.axes.Axes` can be found in
the following table but there might also be other keyword
arguments if another projection is used, see the actual axes
arguments if another projection is used, see the actual Axes
class.

%(Axes:kwdoc)s

Notes
-----
If the figure already has a axes with key (*args*,
If the figure already has an Axes with key (*args*,
*kwargs*) then it will simply make that axes current and
return it. This behavior is deprecated. Meanwhile, if you do
not want this behavior (i.e., you want to force the creation of a
new axes), you must use a unique set of args and kwargs. The axes
new axes), you must use a unique set of args and kwargs. The Axes
*label* attribute has been exposed for this purpose: if you want
two axes that are otherwise identical to be added to the figure,
two Axes that are otherwise identical to be added to the figure,
make sure you give them unique labels.

See Also
Expand All @@ -1057,11 +1057,11 @@ def axes(arg=None, **kwargs):
--------
::

# Creating a new full window axes
# Creating a new full window Axes
plt.axes()

# Creating a new axes with specified dimensions and some kwargs
plt.axes((left, bottom, width, height), facecolor='w')
# Creating a new Axes with specified dimensions and a grey background
plt.axes((left, bottom, width, height), facecolor='grey')
"""
fig = gcf()
pos = kwargs.pop('position', None)
Expand Down Expand Up @@ -1273,7 +1273,7 @@ def subplot(*args, **kwargs):
key = SubplotSpec._from_subplot_args(fig, args)

for ax in fig.axes:
# if we found an axes at the position sort out if we can re-use it
# if we found an Axes at the position sort out if we can re-use it
if hasattr(ax, 'get_subplotspec') and ax.get_subplotspec() == key:
# if the user passed no kwargs, re-use
if kwargs == {}:
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,8 @@ def test_use_sticky_edges():

@check_figures_equal(extensions=["png"])
def test_sticky_shared_axes(fig_test, fig_ref):
# Check that sticky edges work whether they are set in an axes that is a
# "leader" in a share, or an axes that is a "follower".
# Check that sticky edges work whether they are set in an Axes that is a
# "leader" in a share, or an Axes that is a "follower".
Z = np.arange(15).reshape(3, 5)

ax0 = fig_test.add_subplot(211)
Expand Down Expand Up @@ -6151,7 +6151,7 @@ def test_title_above_offset(left, center):


def test_title_no_move_off_page():
# If an axes is off the figure (ie. if it is cropped during a save)
# If an Axes is off the figure (ie. if it is cropped during a save)
# make sure that the automatic title repositioning does not get done.
mpl.rcParams['axes.titley'] = None
fig = plt.figure()
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_constrainedlayout.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def test_colorbar_location():


def test_hidden_axes():
# test that if we make an axes not visible that constrained_layout
# test that if we make an Axes not visible that constrained_layout
# still works. Note the axes still takes space in the layout
# (as does a gridspec slot that is empty)
fig, axs = plt.subplots(2, 2, layout="constrained")
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def test_rotate_rect_draw(fig_test, fig_ref):
ax_ref.add_patch(rect_ref)
assert rect_ref.get_angle() == angle

# Check that when the angle is updated after adding to an axes, that the
# Check that when the angle is updated after adding to an Axes, that the
# patch is marked stale and redrawn in the correct location
rect_test = Rectangle(loc, width, height)
assert rect_test.get_angle() == 0
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/tests/test_pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def test_gca_kwargs():
assert ax1.name == 'polar'
plt.close()

# plt.gca() ignores keyword arguments if an axes already exists.
# plt.gca() ignores keyword arguments if an Axes already exists.
plt.figure()
ax = plt.gca()
with pytest.warns(
Expand All @@ -268,7 +268,7 @@ def test_gca_kwargs():


def test_subplot_projection_reuse():
# create an axes
# create an Axes
ax1 = plt.subplot(111)
# check that it is current
assert ax1 is plt.gca()
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,7 @@ def test_MultiCursor(horizOn, vertOn):
for l in multi.hlines:
assert l.get_ydata() == (.25, .25)

# test a move event in an axes not part of the MultiCursor
# test a move event in an Axes not part of the MultiCursor
# the lines in ax1 and ax2 should not have moved.
event = mock_event(ax3, xdata=.75, ydata=.75)
multi.onmove(event)
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ def contains_branch_seperately(self, other_transform):
each separate dimension.

A common use for this method is to identify if a transform is a blended
transform containing an axes' data transform. e.g.::
transform containing an Axes' data transform. e.g.::

x_isdata, y_isdata = trans.contains_branch_seperately(ax.transData)

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tri/tricontour.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, ax, *args, **kwargs):
depending on whether keyword arg 'filled' is False
(default) or True.

The first argument of the initializer must be an axes
The first argument of the initializer must be an `~.axes.Axes`
object. The remaining arguments and keyword arguments
are described in the docstring of `~.Axes.tricontour`.
"""
Expand Down
Loading