Skip to content

Commit e5a85f9

Browse files
authored
Merge pull request matplotlib#27104 from timhoffm/doc-axes
Use Axes instead of axes in galleries
2 parents 8f296db + 826bf83 commit e5a85f9

File tree

113 files changed

+333
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+333
-333
lines changed

galleries/examples/animation/multiple_axes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
=======================
3-
Multiple axes animation
3+
Multiple Axes animation
44
=======================
55
66
This example showcases:

galleries/examples/animation/random_walk.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def update_lines(num, walks, lines):
4242
# Create lines initially without data
4343
lines = [ax.plot([], [], [])[0] for _ in walks]
4444

45-
# Setting the axes properties
45+
# Setting the Axes properties
4646
ax.set(xlim3d=(0, 1), xlabel='X')
4747
ax.set(ylim3d=(0, 1), ylabel='Y')
4848
ax.set(zlim3d=(0, 1), zlabel='Z')

galleries/examples/axes_grid1/demo_axes_divider.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Axes divider
44
============
55
6-
Axes divider to calculate location of axes and
7-
create a divider for them using existing axes instances.
6+
Axes divider to calculate location of Axes and
7+
create a divider for them using existing Axes instances.
88
"""
99

1010
import matplotlib.pyplot as plt
@@ -30,13 +30,13 @@ def demo_locatable_axes_hard(fig):
3030

3131
divider = SubplotDivider(fig, 2, 2, 2, aspect=True)
3232

33-
# axes for image
33+
# Axes for image
3434
ax = fig.add_subplot(axes_locator=divider.new_locator(nx=0, ny=0))
35-
# axes for colorbar
35+
# Axes for colorbar
3636
ax_cb = fig.add_subplot(axes_locator=divider.new_locator(nx=2, ny=0))
3737

3838
divider.set_horizontal([
39-
Size.AxesX(ax), # main axes
39+
Size.AxesX(ax), # main Axes
4040
Size.Fixed(0.05), # padding, 0.1 inch
4141
Size.Fixed(0.2), # colorbar, 0.3 inch
4242
])

galleries/examples/axes_grid1/demo_axes_grid.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Demo Axes Grid
44
==============
55
6-
Grid of 2x2 images with a single colorbar or with one colorbar per axes.
6+
Grid of 2x2 images with a single colorbar or with one colorbar per Axes.
77
"""
88

99
import matplotlib.pyplot as plt
@@ -17,13 +17,13 @@
1717

1818

1919
# A grid of 2x2 images with 0.05 inch pad between images and only the
20-
# lower-left axes is labeled.
20+
# lower-left Axes is labeled.
2121
grid = ImageGrid(
2222
fig, 141, # similar to fig.add_subplot(141).
2323
nrows_ncols=(2, 2), axes_pad=0.05, label_mode="1")
2424
for ax in grid:
2525
ax.imshow(Z, extent=extent)
26-
# This only affects axes in first column and second row as share_all=False.
26+
# This only affects Axes in first column and second row as share_all=False.
2727
grid.axes_llc.set(xticks=[-2, 0, 2], yticks=[-2, 0, 2])
2828

2929

@@ -37,7 +37,7 @@
3737
grid.cbar_axes[0].colorbar(im)
3838
for cax in grid.cbar_axes:
3939
cax.tick_params(labeltop=False)
40-
# This affects all axes as share_all = True.
40+
# This affects all Axes as share_all = True.
4141
grid.axes_llc.set(xticks=[-2, 0, 2], yticks=[-2, 0, 2])
4242

4343

@@ -50,7 +50,7 @@
5050
im = ax.imshow(Z, extent=extent)
5151
cax.colorbar(im)
5252
cax.tick_params(labeltop=False)
53-
# This affects all axes as share_all = True.
53+
# This affects all Axes as share_all = True.
5454
grid.axes_llc.set(xticks=[-2, 0, 2], yticks=[-2, 0, 2])
5555

5656

@@ -65,7 +65,7 @@
6565
im = ax.imshow(Z, extent=extent, vmin=vlim[0], vmax=vlim[1])
6666
cb = cax.colorbar(im)
6767
cb.set_ticks((vlim[0], vlim[1]))
68-
# This affects all axes as share_all = True.
68+
# This affects all Axes as share_all = True.
6969
grid.axes_llc.set(xticks=[-2, 0, 2], yticks=[-2, 0, 2])
7070

7171

galleries/examples/axes_grid1/demo_axes_grid2.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def add_inner_title(ax, title, loc, **kwargs):
3333
ZS = [Z[i::3, :] for i in range(3)]
3434
extent = extent[0], extent[1]/3., extent[2], extent[3]
3535

36-
# *** Demo 1: colorbar at each axes ***
36+
# *** Demo 1: colorbar at each Axes ***
3737
grid = ImageGrid(
3838
# 211 = at the position of fig.add_subplot(211)
3939
fig, 211, nrows_ncols=(1, 3), axes_pad=0.05, label_mode="1", share_all=True,
@@ -60,7 +60,7 @@ def add_inner_title(ax, title, loc, **kwargs):
6060
for ax, z in zip(grid2, ZS):
6161
im = ax.imshow(z, clim=clim, origin="lower", extent=extent)
6262

63-
# With cbar_mode="single", cax attribute of all axes are identical.
63+
# With cbar_mode="single", cax attribute of all Axes are identical.
6464
ax.cax.colorbar(im)
6565

6666
for ax, im_title in zip(grid2, ["(a)", "(b)", "(c)"]):

galleries/examples/axes_grid1/demo_axes_hbox_divider.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
Using an `.HBoxDivider` to arrange subplots.
77
8-
Note that both axes' location are adjusted so that they have
8+
Note that both Axes' location are adjusted so that they have
99
equal heights while maintaining their aspect ratios.
1010
1111
"""
@@ -36,7 +36,7 @@
3636
# %%
3737
# Using a `.VBoxDivider` to arrange subplots.
3838
#
39-
# Note that both axes' location are adjusted so that they have
39+
# Note that both Axes' location are adjusted so that they have
4040
# equal widths while maintaining their aspect ratios.
4141

4242
fig, (ax1, ax2) = plt.subplots(2, 1)

galleries/examples/axes_grid1/demo_colorbar_with_axes_divider.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
Colorbar with AxesDivider
66
=========================
77
8-
The `.axes_divider.make_axes_locatable` function takes an existing axes, adds
8+
The `.axes_divider.make_axes_locatable` function takes an existing Axes, adds
99
it to a new `.AxesDivider` and returns the `.AxesDivider`. The `.append_axes`
10-
method of the `.AxesDivider` can then be used to create a new axes on a given
11-
side ("top", "right", "bottom", or "left") of the original axes. This example
12-
uses `.append_axes` to add colorbars next to axes.
10+
method of the `.AxesDivider` can then be used to create a new Axes on a given
11+
side ("top", "right", "bottom", or "left") of the original Axes. This example
12+
uses `.append_axes` to add colorbars next to Axes.
1313
14-
Users should consider simply passing the main axes to the *ax* keyword argument of
15-
`~.Figure.colorbar` instead of creating a locatable axes manually like this.
14+
Users should consider simply passing the main Axes to the *ax* keyword argument of
15+
`~.Figure.colorbar` instead of creating a locatable Axes manually like this.
1616
See :ref:`colorbar_placement`.
1717
1818
.. redirect-from:: /gallery/axes_grid1/simple_colorbar

galleries/examples/axes_grid1/demo_colorbar_with_inset_locator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
This example shows how to control the position, height, and width of colorbars
99
using `~mpl_toolkits.axes_grid1.inset_locator.inset_axes`.
1010
11-
Inset axes placement is controlled as for legends: either by providing a *loc*
11+
Inset Axes placement is controlled as for legends: either by providing a *loc*
1212
option ("upper right", "best", ...), or by providing a locator with respect to
1313
the parent bbox. Parameters such as *bbox_to_anchor* and *borderpad* likewise
1414
work in the same way, and are also demonstrated here.

galleries/examples/axes_grid1/demo_edge_colorbar.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def demo_bottom_cbar(fig):
4444
for cax in grid.cbar_axes:
4545
cax.axis[cax.orientation].set_label("Bar")
4646

47-
# This affects all axes as share_all = True.
47+
# This affects all Axes as share_all = True.
4848
grid.axes_llc.set_xticks([-2, 0, 2])
4949
grid.axes_llc.set_yticks([-2, 0, 2])
5050

@@ -73,7 +73,7 @@ def demo_right_cbar(fig):
7373
for cax in grid.cbar_axes:
7474
cax.axis[cax.orientation].set_label('Foo')
7575

76-
# This affects all axes because we set share_all = True.
76+
# This affects all Axes because we set share_all = True.
7777
grid.axes_llc.set_xticks([-2, 0, 2])
7878
grid.axes_llc.set_yticks([-2, 0, 2])
7979

galleries/examples/axes_grid1/demo_fixed_size_axes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
fig = plt.figure(figsize=(6, 6))
1818

19-
# The first items are for padding and the second items are for the axes.
19+
# The first items are for padding and the second items are for the Axes.
2020
# sizes are in inch.
2121
h = [Size.Fixed(1.0), Size.Fixed(4.5)]
2222
v = [Size.Fixed(0.7), Size.Fixed(5.)]
@@ -35,7 +35,7 @@
3535
fig = plt.figure(figsize=(6, 6))
3636

3737
# The first & third items are for padding and the second items are for the
38-
# axes. Sizes are in inches.
38+
# Axes. Sizes are in inches.
3939
h = [Size.Fixed(1.0), Size.Scaled(1.), Size.Fixed(.2)]
4040
v = [Size.Fixed(0.7), Size.Scaled(1.), Size.Fixed(.5)]
4141

galleries/examples/axes_grid1/inset_locator_demo.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# %%
99
# The `.inset_locator`'s `~.inset_locator.inset_axes` allows
10-
# easily placing insets in the corners of the axes by specifying a width and
10+
# easily placing insets in the corners of the Axes by specifying a width and
1111
# height and optionally a location (loc) that accepts locations as codes,
1212
# similar to `~matplotlib.axes.Axes.legend`.
1313
# By default, the inset is offset by some points from the axes,
@@ -23,17 +23,17 @@
2323
# at the default upper right location
2424
axins = inset_axes(ax, width=1.3, height=0.9)
2525

26-
# Create inset of width 30% and height 40% of the parent axes' bounding box
26+
# Create inset of width 30% and height 40% of the parent Axes' bounding box
2727
# at the lower left corner (loc=3)
2828
axins2 = inset_axes(ax, width="30%", height="40%", loc=3)
2929

3030
# Create inset of mixed specifications in the second subplot;
31-
# width is 30% of parent axes' bounding box and
31+
# width is 30% of parent Axes' bounding box and
3232
# height is 1 inch at the upper left corner (loc=2)
3333
axins3 = inset_axes(ax2, width="30%", height=1., loc=2)
3434

3535
# Create an inset in the lower right corner (loc=4) with borderpad=1, i.e.
36-
# 10 points padding (as 10pt is the default fontsize) to the parent axes
36+
# 10 points padding (as 10pt is the default fontsize) to the parent Axes
3737
axins4 = inset_axes(ax2, width="20%", height="20%", loc=4, borderpad=1)
3838

3939
# Turn ticklabels of insets off
@@ -54,9 +54,9 @@
5454
fig = plt.figure(figsize=[5.5, 2.8])
5555
ax = fig.add_subplot(121)
5656

57-
# We use the axes transform as bbox_transform. Therefore, the bounding box
57+
# We use the Axes transform as bbox_transform. Therefore, the bounding box
5858
# needs to be specified in axes coordinates ((0, 0) is the lower left corner
59-
# of the axes, (1, 1) is the upper right corner).
59+
# of the Axes, (1, 1) is the upper right corner).
6060
# The bounding box (.2, .4, .6, .5) starts at (.2, .4) and ranges to (.8, .9)
6161
# in those coordinates.
6262
# Inside this bounding box an inset of half the bounding box' width and
@@ -78,7 +78,7 @@
7878

7979

8080
# Note how the two following insets are created at the same positions, one by
81-
# use of the default parent axes' bbox and the other via a bbox in axes
81+
# use of the default parent Axes' bbox and the other via a bbox in Axes
8282
# coordinates and the respective transform.
8383
ax2 = fig.add_subplot(222)
8484
axins2 = inset_axes(ax2, width="30%", height="50%")
@@ -101,16 +101,16 @@
101101

102102

103103
# %%
104-
# In the above the axes transform together with 4-tuple bounding boxes has been
105-
# used as it mostly is useful to specify an inset relative to the axes it is
104+
# In the above the Axes transform together with 4-tuple bounding boxes has been
105+
# used as it mostly is useful to specify an inset relative to the Axes it is
106106
# an inset to. However, other use cases are equally possible. The following
107107
# example examines some of those.
108108
#
109109

110110
fig = plt.figure(figsize=[5.5, 2.8])
111111
ax = fig.add_subplot(131)
112112

113-
# Create an inset outside the axes
113+
# Create an inset outside the Axes
114114
axins = inset_axes(ax, width="100%", height="100%",
115115
bbox_to_anchor=(1.05, .6, .5, .4),
116116
bbox_transform=ax.transAxes, loc=2, borderpad=0)
@@ -134,7 +134,7 @@
134134
bbox_transform=ax2.transData, loc=2, borderpad=0)
135135

136136
# Create an inset horizontally centered in figure coordinates and vertically
137-
# bound to line up with the axes.
137+
# bound to line up with the Axes.
138138
from matplotlib.transforms import blended_transform_factory # noqa
139139

140140
transform = blended_transform_factory(fig.transFigure, ax2.transAxes)

galleries/examples/axes_grid1/inset_locator_demo2.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
ax.set_aspect(1)
2727

2828
axins = zoomed_inset_axes(ax, zoom=0.5, loc='upper right')
29-
# fix the number of ticks on the inset axes
29+
# fix the number of ticks on the inset Axes
3030
axins.yaxis.get_major_locator().set_params(nbins=7)
3131
axins.xaxis.get_major_locator().set_params(nbins=7)
3232
axins.tick_params(labelleft=False, labelbottom=False)
@@ -61,13 +61,13 @@ def add_sizebar(ax, size):
6161
x1, x2, y1, y2 = -1.5, -0.9, -2.5, -1.9
6262
axins2.set_xlim(x1, x2)
6363
axins2.set_ylim(y1, y2)
64-
# fix the number of ticks on the inset axes
64+
# fix the number of ticks on the inset Axes
6565
axins2.yaxis.get_major_locator().set_params(nbins=7)
6666
axins2.xaxis.get_major_locator().set_params(nbins=7)
6767
axins2.tick_params(labelleft=False, labelbottom=False)
6868

69-
# draw a bbox of the region of the inset axes in the parent axes and
70-
# connecting lines between the bbox and the inset axes area
69+
# draw a bbox of the region of the inset Axes in the parent Axes and
70+
# connecting lines between the bbox and the inset Axes area
7171
mark_inset(ax2, axins2, loc1=2, loc2=4, fc="none", ec="0.5")
7272

7373
plt.show()

galleries/examples/axes_grid1/scatter_hist_locatable_axes.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
Show the marginal distributions of a scatter plot as histograms at the sides of
77
the plot.
88
9-
For a nice alignment of the main axes with the marginals, the axes positions
9+
For a nice alignment of the main Axes with the marginals, the Axes positions
1010
are defined by a ``Divider``, produced via `.make_axes_locatable`. Note that
11-
the ``Divider`` API allows setting axes sizes and pads in inches, which is its
11+
the ``Divider`` API allows setting Axes sizes and pads in inches, which is its
1212
main feature.
1313
14-
If one wants to set axes sizes and pads relative to the main Figure, see the
14+
If one wants to set Axes sizes and pads relative to the main Figure, see the
1515
:doc:`/gallery/lines_bars_and_markers/scatter_hist` example.
1616
"""
1717

@@ -33,10 +33,10 @@
3333
# the scatter plot:
3434
ax.scatter(x, y)
3535

36-
# Set aspect of the main axes.
36+
# Set aspect of the main Axes.
3737
ax.set_aspect(1.)
3838

39-
# create new axes on the right and on the top of the current axes
39+
# create new Axes on the right and on the top of the current Axes
4040
divider = make_axes_locatable(ax)
4141
# below height and pad are in inches
4242
ax_histx = divider.append_axes("top", 1.2, pad=0.1, sharex=ax)

galleries/examples/axes_grid1/simple_axes_divider1.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def label_axes(ax, text):
2020

2121

2222
# %%
23-
# Fixed axes sizes; fixed paddings.
23+
# Fixed Axes sizes; fixed paddings.
2424

2525
fig = plt.figure(figsize=(6, 6))
2626
fig.suptitle("Fixed axes sizes, fixed paddings")
@@ -30,7 +30,7 @@ def label_axes(ax, text):
3030
vert = [Size.Fixed(1.5), Size.Fixed(.5), Size.Fixed(1.)]
3131

3232
rect = (0.1, 0.1, 0.8, 0.8)
33-
# Divide the axes rectangle into a grid with sizes specified by horiz * vert.
33+
# Divide the Axes rectangle into a grid with sizes specified by horiz * vert.
3434
div = Divider(fig, rect, horiz, vert, aspect=False)
3535

3636
# The rect parameter will actually be ignored and overridden by axes_locator.
@@ -53,7 +53,7 @@ def label_axes(ax, text):
5353
vert = [Size.Scaled(1.), Size.Fixed(.5), Size.Scaled(1.5)]
5454

5555
rect = (0.1, 0.1, 0.8, 0.8)
56-
# Divide the axes rectangle into a grid with sizes specified by horiz * vert.
56+
# Divide the Axes rectangle into a grid with sizes specified by horiz * vert.
5757
div = Divider(fig, rect, horiz, vert, aspect=False)
5858

5959
# The rect parameter will actually be ignored and overridden by axes_locator.

galleries/examples/axes_grid1/simple_axes_divider3.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
horiz = [Size.AxesX(ax[0]), Size.Fixed(.5), Size.AxesX(ax[1])]
2222
vert = [Size.AxesY(ax[0]), Size.Fixed(.5), Size.AxesY(ax[2])]
2323

24-
# divide the axes rectangle into grid whose size is specified by horiz * vert
24+
# divide the Axes rectangle into grid whose size is specified by horiz * vert
2525
divider = Divider(fig, rect, horiz, vert, aspect=False)
2626

2727

galleries/examples/axes_grid1/simple_axesgrid.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
fig = plt.figure(figsize=(4., 4.))
2020
grid = ImageGrid(fig, 111, # similar to subplot(111)
21-
nrows_ncols=(2, 2), # creates 2x2 grid of axes
22-
axes_pad=0.1, # pad between axes in inch.
21+
nrows_ncols=(2, 2), # creates 2x2 grid of Axes
22+
axes_pad=0.1, # pad between Axes in inch.
2323
)
2424

2525
for ax, im in zip(grid, [im1, im2, im3, im4]):

galleries/examples/axisartist/demo_axisline_style.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
66
This example shows some configurations for axis style.
77
8-
Note: The `mpl_toolkits.axisartist` axes classes may be confusing for new
8+
Note: The `mpl_toolkits.axisartist` Axes classes may be confusing for new
99
users. If the only aim is to obtain arrow heads at the ends of the axes,
1010
rather check out the :doc:`/gallery/spines/centered_spines_with_arrows`
1111
example.

galleries/examples/axisartist/demo_curvelinear_grid.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def curvelinear_test2(fig):
9090

9191
ax1.grid(True, zorder=0)
9292

93-
# A parasite axes with given transform
93+
# A parasite Axes with given transform
9494
ax2 = ax1.get_aux_axes(tr)
9595
# note that ax2.transData == tr + ax1.transData
9696
# Anything you draw in ax2 will match the ticks and grids of ax1.

0 commit comments

Comments
 (0)