8000 Second pass · matplotlib/matplotlib@a9aa03c · GitHub
[go: up one dir, main page]

Skip to content

Commit a9aa03c

Browse files
committed
Second pass
1 parent 51d3865 commit a9aa03c

Some content is hidden

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

49 files changed

+105
-104
lines changed

doc/api/prev_api_changes/api_changes_2.0.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ call the function with ::
169169
where "ax" is an ``Axes3d`` object created with something like ::
170170

171171
import mpl_toolkits.mplot3d.axes3d
172-
ax = plt.subplot(111, projection='3d')
172+
ax = plt.subplot(1, 1, 1, projection='3d')
173173

174174

175175
Stale figure behavior

doc/api/prev_api_changes/api_changes_3.2.0/behavior.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ mplot3d auto-registration
306306
`mpl_toolkits.mplot3d` is always registered by default now. It is no
307307
longer necessary to import mplot3d to create 3d axes with ::
308308

309-
ax = fig.add_subplot(111, projection="3d")
309+
ax = fig.add_subplot(1, 1, 1, projection="3d")
310310

311311
`.SymLogNorm` now has a *base* parameter
312312
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

doc/faq/howto_faq.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ The Axes property :meth:`~matplotlib.axes.Axes.set_aspect` controls the
368368
aspect ratio of the axes. You can set it to be 'auto', 'equal', or
369369
some ratio which controls the ratio::
370370

371-
ax = fig.add_subplot(111, aspect='equal')
371+
ax = fig.add_subplot(1, 1, 1, aspect='equal')
372372

373373
.. only:: html
374374

doc/users/history.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ Matplotlib's original logo (2003 -- 2008).
114114
# 0.0005 is the sample interval
115115
t = 0.0005 * np.arange(len(x))
116116
plt.figure(1, figsize=(7, 1), dpi=100)
117-
ax = plt.subplot(111, facecolor='y')
117+
ax = plt.subplot(1, 1, 1, facecolor='y')
118118
plt.plot(t, x)
119119
plt.text(0.5, 0.5, 'matplotlib', color='r',
120120
fontsize=40, fontname=['Courier', 'DejaVu Sans Mono'],

doc/users/prev_whats_new/changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2290,7 +2290,7 @@ the `API changes <../../api/api_changes.html>`_.
22902290
fig2 = figure()
22912291

22922292
ax1 = fig1.add_subplot(1, 1, 1)
2293-
ax2 = fig2.add_subplot(111, sharex=ax1, sharey=ax1)
2293+
ax2 = fig2.add_subplot(1, 1, 1, sharex=ax1, sharey=ax1)
22942294

22952295
- linestyles now include steps-pre, steps-post and
22962296
steps-mid. The old step still works and is equivalent to

doc/users/prev_whats_new/whats_new_0.98.4.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ boxes and connectors in annotations. See
9797
ax.yaxis.set_visible(False)
9898

9999

100-
ax1 = fig.add_subplot(121, frameon=False, xticks=[], yticks=[])
100+
ax1 = fig.add_subplot(1, 2, 1, frameon=False, xticks=[], yticks=[])
101101
make_boxstyles(ax1)
102102

103-
ax2 = fig.add_subplot(122, frameon=False, xticks=[], yticks=[])
103+
ax2 = fig.add_subplot(1, 2, 2, frameon=False, xticks=[], yticks=[])
104104
make_arrowstyles(ax2)
105105

106106

doc/users/prev_whats_new/whats_new_1.3.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ oddly distributed data sets.
176176
Calling subplot() without arguments
177177
```````````````````````````````````
178178
A call to :func:`~matplotlib.pyplot.subplot` without any arguments now
179-
acts the same as ``subplot(1, 1, 1)`` or ``subplot(1, 1, 1)`` -- it creates one
179+
acts the same as ``subplot(111)`` or ``subplot(1, 1, 1)`` -- it creates one
180180
axes for the whole figure. This was already the behavior for both
181181
:func:`~matplotlib.pyplot.axes` and
182182
:func:`~matplotlib.pyplot.subplots`, and now this consistency is

doc/users/prev_whats_new/whats_new_1.5.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ column line plots.
447447

448448
from mpl_toolkits.mplot3d import Axes3D, axes3d
449449
fig = plt.figure()
450-
ax = fig.add_subplot(111, projection='3d')
450+
ax = fig.add_subplot(1, 1, 1, projection='3d')
451451
X, Y, Z = axes3d.get_test_data(0.05)
452452
ax.plot_wireframe(X, Y, Z, rstride=10, cstride=0)
453453

examples/animation/double_pendulum_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def derivs(state, t):
7070
y2 = -L2*cos(y[:, 2]) + y1
7171

7272
fig = plt.figure()
73-
ax = fig.add_subplot(111, autoscale_on=False, xlim=(-2, 2), ylim=(-2, 2))
73+
ax = fig.add_subplot(1, 1, 1, autoscale_on=False, xlim=(-2, 2), ylim=(-2, 2))
7474
ax.set_aspect('equal')
7575
ax.grid()
7676

examples/animation/unchained.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
fig = plt.figure(figsize=(8, 8), facecolor='black')
2222

2323
# Add a subplot with no frame
24-
ax = plt.subplot(111, frameon=False)
24+
ax = plt.subplot(1, 1, 1, frameon=False)
2525

2626
# Generate random data
2727
data = np.random.uniform(0, 1, (64, 75))

examples/axisartist/demo_parasite_axes2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from mpl_toolkits import axisartist
2727
import matplotlib.pyplot as plt
2828

29-
host = host_subplot(111, axes_class=axisartist.Axes)
29+
host = host_subplot(1, 1, 1, axes_class=axisartist.Axes)
3030
plt.subplots_adjust(right=0.75)
3131

3232
par1 = host.twinx()

examples/event_handling/trifinder_event_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def on_mouse_move(event):
5252
trifinder = triang.get_trifinder()
5353

5454
# Setup plot and callbacks.
55-
plt.subplot(111, aspect='equal')
55+
plt.subplot(1, 1, 1, aspect='equal')
5656
plt.triplot(triang, 'bo-')
5757
polygon = Polygon([[0, 0], [0, 0]], facecolor='y') # dummy data for (xs, ys)
5858
update_polygon(-1)

examples/misc/agg_buffer_to_array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525

2626
# now display the array X as an Axes in a new figure
2727
fig2 = plt.figure()
28-
ax2 = fig2.add_subplot(111, frameon=False)
28+
ax2 = fig2.add_subplot(1, 1, 1, frameon=False)
2929
ax2.imshow(X)
3030
plt.show()

examples/misc/custom_projection.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ class HammerAxes(GeoAxes):
370370

371371
# The projection must specify a name. This will be used by the
372372
# user to select the projection,
373-
# i.e. ``subplot(111, projection='custom_hammer')``.
373+
# i.e. ``subplot(1, 1, 1, projection='custom_hammer')``.
374374
name = 'custom_hammer'
375375

376376
class HammerTransform(Transform):
@@ -441,7 +441,7 @@ def _get_core_transform(self, resolution):
441441
if __name__ == '__main__':
442442
import matplotlib.pyplot as plt
443443
# Now make a simple example using the custom projection.
444-
plt.subplot(111, projection="custom_hammer")
444+
plt.subplot(1, 1, 1, projection="custom_hammer")
445445
p = plt.plot([-1, 1, 1], [-1, -1, 1], "o-")
446446
plt.grid(True)
447447

examples/mplot3d/3d_bars.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
# setup the figure and axes
1414
fig = plt.figure(figsize=(8, 3))
15-
ax1 = fig.add_subplot(121, projection='3d')
16-
ax2 = fig.add_subplot(122, projection='3d')
15+
ax1 = fig.add_subplot(1, 2, 1, projection='3d')
16+
ax2 = fig.add_subplot(1, 2, 2, projection='3d')
1717

1818
# fake data
1919
_x = np.arange(4)

examples/mplot3d/bars3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
fig = plt.figure()
18-
ax = fig.add_subplot(111, projection='3d')
18+
ax = fig.add_subplot(1, 1, 1, projection='3d')
1919

2020
colors = ['r', 'g', 'b', 'y']
2121
yticks = [3, 2, 1, 0]

examples/mplot3d/hist3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
fig = plt.figure()
17-
ax = fig.add_subplot(111, projection='3d')
17+
ax = fig.add_subplot(1, 1, 1, projection='3d')
1818
x, y = np.random.rand(2, 100) * 4
1919
hist, xedges, yedges = np.histogram2d(x, y, bins=4, range=[[0, 4], [0, 4]])
2020

examples/mplot3d/pathpatch3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def text3d(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs):
4141

4242

4343
fig = plt.figure()
44-
ax = fig.add_subplot(111, projection='3d')
44+
ax = fig.add_subplot(1, 1, 1, projection='3d')
4545

4646
# Draw a circle on the x=0 'wall'
4747
p = Circle((5, 5), 3)

examples/mplot3d/rotate_axes3d_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import matplotlib.pyplot as plt
1616

1717
fig = plt.figure()
18-
ax = fig.add_subplot(111, projection='3d')
18+
ax = fig.add_subplot(1, 1, 1, projection='3d')
1919

2020
# load some test data for demonstration and plot a wireframe
2121
X, Y, Z = axes3d.get_test_data(0.1)

examples/mplot3d/scatter3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def randrange(n, vmin, vmax):
2121
return (vmax - vmin)*np.random.rand(n) + vmin
2222

2323
fig = plt.figure()
24-
ax = fig.add_subplot(111, projection='3d')
24+
ax = fig.add_subplot(1, 1, 1, projection='3d')
2525

2626
n = 100
2727

examples/mplot3d/surface3d_2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
fig = plt.figure()
14-
ax = fig.add_subplot(111, projection='3d')
14+
ax = fig.add_subplot(1, 1, 1, projection='3d')
1515

1616
# Make data
1717
u = np.linspace(0, 2 * np.pi, 100)

examples/mplot3d/surface3d_radial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
fig = plt.figure()
18-
ax = fig.add_subplot(111, projection='3d')
18+
ax = fig.add_subplot(1, 1, 1, projection='3d')
1919

2020
# Create the mesh in polar coordinates and compute corresponding Z.
2121
r = np.linspace(0, 1.25, 50)

examples/mplot3d/wire3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
fig = plt.figure()
14-
ax = fig.add_subplot(111, projection='3d')
14+
ax = fig.add_subplot(1, 1, 1, projection='3d')
1515

1616
# Grab some test data.
1717
X, Y, Z = axes3d.get_test_data(0.05)

examples/mplot3d/wire3d_animation_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def generate(X, Y, phi):
2323

2424

2525
fig = plt.figure()
26-
ax = fig.add_subplot(111, projection='3d')
26+
ax = fig.add_subplot(1, 1, 1, projection='3d')
2727

2828
# Make the X, Y meshgrid.
2929
xs = np.linspace(-1, 1, 50)

examples/pie_and_polar_charts/polar_bar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
width = np.pi / 4 * np.random.rand(N)
2020
colors = plt.cm.viridis(radii / 10.)
2121

22-
ax = plt.subplot(111, projection='polar')
22+
ax = plt.subplot(1, 1, 1, projection='polar')
2323
ax.bar(theta, radii, width=width, bottom=0.0, color=colors, alpha=0.5)
2424

2525
plt.show()

examples/pie_and_polar_charts/polar_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
r = np.arange(0, 2, 0.01)
1313
theta = 2 * np.pi * r
1414

15-
ax = plt.subplot(111, projection='polar')
15+
ax = plt.subplot(1, 1, 1, projection='polar')
1616
ax.plot(theta, r)
1717
ax.set_rmax(2)
1818
ax.set_rticks([0.5, 1, 1.5, 2]) # Less radial ticks

examples/pie_and_polar_charts/polar_scatter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
colors = theta
2222

2323
fig = plt.figure()
24-
ax = fig.add_subplot(111, projection='polar')
24+
ax = fig.add_subplot(1, 1, 1, projection='polar')
2525
c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)
2626

2727
###############################################################################
@@ -33,7 +33,7 @@
3333
# rotate the plot.
3434

3535
fig = plt.figure()
36-
ax = fig.add_subplot(111, polar=True)
36+
ax = fig.add_subplot(1, 1, 1, polar=True)
3737
c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)
3838

3939
ax.set_rorigin(-2.5)
@@ -47,7 +47,7 @@
4747
# theta start and end limits, producing a sector instead of a full circle.
4848

4949
fig = plt.figure()
50-
ax = fig.add_subplot(111, polar=True)
50+
ax = fig.add_subplot(1, 1, 1, polar=True)
5151
c = ax.scatter(theta, r, c=colors, s=area, cmap='hsv', alpha=0.75)
5252

5353
ax.set_thetamin(45)

examples/pyplots/annotation_polar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import matplotlib.pyplot as plt
1313

1414
fig = plt.figure()
15-
ax = fig.add_subplot(111, polar=True)
15+
ax = fig.add_subplot(1, 1, 1, polar=True)
1616
r = np.arange(0, 1, 0.001)
1717
theta = 2 * 2*np.pi * r
1818
line, = ax.plot(theta, r, color='#ee8d18', lw=3)

examples/recipes/create_subplots.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
# old style
2121
fig = plt.figure()
2222
ax1 = fig.add_subplot(2, 2, 1)
23-
ax2 = fig.add_subplot(222, sharex=ax1, sharey=ax1)
24-
ax3 = fig.add_subplot(223, sharex=ax1, sharey=ax1)
25-
ax3 = fig.add_subplot(224, sharex=ax1, sharey=ax1)
23+
ax2 = fig.add_subplot(2, 2, 2, sharex=ax1, sharey=ax1)
24+
ax3 = fig.add_subplot(2, 2, 3, sharex=ax1, sharey=ax1)
25+
ax3 = fig.add_subplot(2, 2, 4, sharex=ax1, sharey=ax1)
2626

2727
###############################################################################
2828
# Fernando Perez has provided the nice top-level function

examples/recipes/share_axis_lims_views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
ax1 = plt.subplot(2, 1, 1)
1919
ax1.plot(t, np.sin(2*np.pi*t))
2020

21-
ax2 = plt.subplot(212, sharex=ax1)
21+
ax2 = plt.subplot(2, 1, 2, sharex=ax1)
2222
ax2.plot(t, np.sin(4*np.pi*t))
2323

2424
plt.show()

examples/specialty_plots/skewt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def _adjust_location(self):
7979
# spines and axes instances as appropriate.
8080
class SkewXAxes(Axes):
8181
# The projection must specify a name. This will be used be the
82-
# user to select the projection, i.e. ``subplot(111,
82+
# user to select the projection, i.e. ``subplot(1, 1, 1,
8383
# projection='skewx')``.
8484
name = 'skewx'
8585

@@ -236,7 +236,7 @@ def upper_xlim(self):
236236

237237
# Create a new figure. The dimensions here give a good aspect ratio
238238
fig = plt.figure(figsize=(6.5875, 6.2125))
239-
ax = fig.add_subplot(111, projection='skewx')
239+
ax = fig.add_subplot(1, 1, 1, projection='skewx')
240240

241241
plt.grid(True)
242242

examples/subplots_axes_and_figures/geo_demo.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,28 @@
1414
###############################################################################
1515

1616
plt.figure()
17-
plt.subplot(111, projection="aitoff")
17+
plt.subplot(1, 1, 1, projection="aitoff")
1818
plt.title("Aitoff")
1919
plt.grid(True)
2020

2121
###############################################################################
2222

2323
plt.figure()
24-
plt.subplot(111, projection="hammer")
24+
plt.subplot(1, 1, 1, projection="hammer")
2525
plt.title("Hammer")
2626
plt.grid(True)
2727

2828
###############################################################################
2929

3030
plt.figure()
31-
plt.subplot(111, projection="lambert")
31+
plt.subplot(1, 1, 1, projection="lambert")
3232
plt.title("Lambert")
3333
plt.grid(True)
3434

3535
###############################################################################
3636

3737
plt.figure()
38-
plt.subplot(111, projection="mollweide")
38+
plt.subplot(1, 1, 1, projection="mollweide")
3939
plt.title("Mollweide")
4040
plt.grid(True)
4141

examples/subplots_axes_and_figures/shared_axis_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@
4545
plt.setp(ax1.get_xticklabels(), fontsize=6)
4646

4747
# share x only
48-
ax2 = plt.subplot(312, sharex=ax1)
48+
ax2 = plt.subplot(3, 1, 2, sharex=ax1)
4949
plt.plot(t, s2)
5050
# make these tick labels invisible
5151
plt.setp(ax2.get_xticklabels(), visible=False)
5252

5353
# share x and y
54-
ax3 = plt.subplot(313, sharex=ax1, sharey=ax1)
54+
ax3 = plt.subplot(3, 1, 3, sharex=ax1, sharey=ax1)
5555
plt.plot(t, s3)
5656
plt.xlim(0.01, 5.0)
5757
plt.show()

0 commit comments

Comments
 (0)
0