Skip to content

Commit 9340190

Browse files
authored
Merge pull request matplotlib#28764 from oscargus/exampletesttyping
Fix argument types in examples and tests
2 parents 5a10e4d + edc8b20 commit 9340190

File tree

72 files changed

+202
-202
lines changed

Some content is hidden

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

72 files changed

+202
-202
lines changed

doc/project/history.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Matplotlib logo (2008 - 2015).
157157

158158

159159
def add_math_background():
160-
ax = fig.add_axes([0., 0., 1., 1.])
160+
ax = fig.add_axes((0., 0., 1., 1.))
161161

162162
text = []
163163
text.append(
@@ -187,7 +187,7 @@ Matplotlib logo (2008 - 2015).
187187

188188

189189
def add_polar_bar():
190-
ax = fig.add_axes([0.025, 0.075, 0.2, 0.85], projection='polar')
190+
ax = fig.add_axes((0.025, 0.075, 0.2, 0.85), projection='polar')
191191

192192
ax.patch.set_alpha(axalpha)
193193
ax.set_axisbelow(True)

doc/users/prev_whats_new/dflt_style_changes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ a cleaner separation between subplots.
10051005

10061006
ax = fig.add_subplot(2, 2, j)
10071007
ax.hist(np.random.beta(0.5, 0.5, 10000), 25, density=True)
1008-
ax.set_xlim([0, 1])
1008+
ax.set_xlim(0, 1)
10091009
ax.set_title(title)
10101010

10111011
ax = fig.add_subplot(2, 2, j + 2)

doc/users/prev_whats_new/whats_new_3.5.0.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,9 @@ of the text inside the Axes of the `.TextBox` widget.
274274

275275
fig = plt.figure(figsize=(4, 3))
276276
for i, alignment in enumerate(['left', 'center', 'right']):
277-
box_input = fig.add_axes([0.1, 0.7 - i*0.3, 0.8, 0.2])
278-
text_box = TextBox(ax=box_input, initial=f'{alignment} alignment',
279-
label='', textalignment=alignment)
277+
box_input = fig.add_axes((0.1, 0.7 - i*0.3, 0.8, 0.2))
278+
text_box = TextBox(ax=box_input, initial=f'{alignment} alignment',
279+
label='', textalignment=alignment)
280280

281281
Simplifying the font setting for usetex mode
282282
--------------------------------------------
@@ -375,9 +375,9 @@ attribute.
375375
points = ax.scatter((3, 3), (1, 3), (1, 3), c='red', zorder=10,
376376
label='zorder=10')
377377

378-
ax.set_xlim((0, 5))
379-
ax.set_ylim((0, 5))
380-
ax.set_zlim((0, 2.5))
378+
ax.set_xlim(0, 5)
379+
ax.set_ylim(0, 5)
380+
ax.set_zlim(0, 2.5)
381381

382382
plane = mpatches.Patch(facecolor='white', edgecolor='black',
383383
label='zorder=1')
@@ -485,7 +485,7 @@ new styling parameters for the added handles.
485485
ax = ax_old
486486
valmin = 0
487487
valinit = 0.5
488-
ax.set_xlim([0, 1])
488+
ax.set_xlim(0, 1)
489489
ax_old.axvspan(valmin, valinit, 0, 1)
490490
ax.axvline(valinit, 0, 1, color="r", lw=1)
491491
ax.set_xticks([])

galleries/examples/animation/rain.py

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

2323
# Create new Figure and an Axes which fills it.
2424
fig = plt.figure(figsize=(7, 7))
25-
ax = fig.add_axes([0, 0, 1, 1], frameon=False)
25+
ax = fig.add_axes((0, 0, 1, 1), frameon=False)
2626
ax.set_xlim(0, 1), ax.set_xticks([])
2727
ax.set_ylim(0, 1), ax.set_yticks([])
2828

galleries/examples/animation/simple_scatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import matplotlib.animation as animation
1212

1313
fig, ax = plt.subplots()
14-
ax.set_xlim([0, 10])
14+
ax.set_xlim(0, 10)
1515

1616
scat = ax.scatter(1, 0)
1717
x = np.linspace(0, 10)

galleries/examples/axes_grid1/make_room_for_ylabel_using_axesgrid.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from mpl_toolkits.axes_grid1.axes_divider import make_axes_area_auto_adjustable
1111

1212
fig = plt.figure()
13-
ax = fig.add_axes([0, 0, 1, 1])
13+
ax = fig.add_axes((0, 0, 1, 1))
1414

1515
ax.set_yticks([0.5], labels=["very long label"])
1616

@@ -19,8 +19,8 @@
1919
# %%
2020

2121
fig = plt.figure()
22-
ax1 = fig.add_axes([0, 0, 1, 0.5])
23-
ax2 = fig.add_axes([0, 0.5, 1, 0.5])
22+
ax1 = fig.add_axes((0, 0, 1, 0.5))
23+
ax2 = fig.add_axes((0, 0.5, 1, 0.5))
2424

2525
ax1.set_yticks([0.5], labels=["very long label"])
2626
ax1.set_ylabel("Y label")
@@ -33,7 +33,7 @@
3333
# %%
3434

3535
fig = plt.figure()
36-
ax1 = fig.add_axes([0, 0, 1, 1])
36+
ax1 = fig.add_axes((0, 0, 1, 1))
3737
divider = make_axes_locatable(ax1)
3838

3939
ax2 = divider.append_axes("right", "100%", pad=0.3, sharey=ax1)

galleries/examples/axisartist/demo_parasite_axes.py

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

2525
fig = plt.figure()
2626

27-
host = fig.add_axes([0.15, 0.1, 0.65, 0.8], axes_class=HostAxes)
27+
host = fig.add_axes((0.15, 0.1, 0.65, 0.8), axes_class=HostAxes)
2828
par1 = host.get_aux_axes(viewlim_mode=None, sharex=host)
2929
par2 = host.get_aux_axes(viewlim_mode=None, sharex=host)
3030

galleries/examples/event_handling/poly_editor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,6 @@ def on_mouse_move(self, event):
203203
p = PolygonInteractor(ax, poly)
204204

205205
ax.set_title('Click and drag a point to move it')
206-
ax.set_xlim((-2, 2))
207-
ax.set_ylim((-2, 2))
206+
ax.set_xlim(-2, 2)
207+
ax.set_ylim(-2, 2)
208208
plt.show()

galleries/examples/event_handling/pong_sgskip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ def __init__(self, ax):
134134
# create the initial line
135135
self.ax = ax
136136
ax.xaxis.set_visible(False)
137-
ax.set_xlim([0, 7])
137+
ax.set_xlim(0, 7)
138138
ax.yaxis.set_visible(False)
139-
ax.set_ylim([-1, 1])
139+
ax.set_ylim(-1, 1)
140140
pad_a_x = 0
141141
pad_b_x = .50
142142
pad_a_y = pad_b_y = .30

galleries/examples/images_contours_and_fields/barcode_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
dpi = 100
3131

3232
fig = plt.figure(figsize=(len(code) * pixel_per_bar / dpi, 2), dpi=dpi)
33-
ax = fig.add_axes([0, 0, 1, 1]) # span the whole figure
33+
ax = fig.add_axes((0, 0, 1, 1)) # span the whole figure
3434
ax.set_axis_off()
3535
ax.imshow(code.reshape(1, -1), cmap='binary', aspect='auto',
3636
interpolation='nearest')

0 commit comments

Comments
 (0)