8000 Change first argument to set_xlim and set_ylim from list to tuple · matplotlib/matplotlib@4122887 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 4122887

Browse files
committed
Change first argument to set_xlim and set_ylim from list to tuple
1 parent 53383cf commit 4122887

File tree

19 files changed

+32
-32
lines changed

19 files changed

+32
-32
lines changed

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( 8000 [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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/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/event_handling/pong_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ 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)
139139
ax.set_ylim([-1, 1])
140140
pad_a_x = 0

galleries/examples/lines_bars_and_markers/eventcollection_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
ax.add_collection(yevents2)
5454

5555
# set the limits
56-
ax.set_xlim([0, 1])
57-
ax.set_ylim([0, 1])
56+
ax.set_xlim((0, 1))
57+
ax.set_ylim((0, 1))
5858

5959
ax.set_title('line plot with data points')
6060

galleries/examples/scales/scales.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def inverse(a):
9595
ax.set_yscale('function', functions=(forward, inverse))
9696
ax.set_title('function: Mercator')
9797
ax.grid(True)
98-
ax.set_xlim([0, 180])
98+
ax.set_xlim((0, 180))
9999
ax.yaxis.set_minor_formatter(NullFormatter())
100100
ax.yaxis.set_major_locator(FixedLocator(np.arange(0, 90, 10)))
101101

galleries/examples/shapes_and_collections/hatch_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
hatch='*', facecolor='y'))
4242
axs['patches'].add_patch(Polygon([(10, 20), (30, 50), (50, 10)],
4343
hatch='\\/...', facecolor='g'))
44-
axs['patches'].set_xlim([0, 40])
45-
axs['patches'].set_ylim([10, 60])
44+
axs['patches'].set_xlim((0, 40))
45+
axs['patches'].set_ylim((10, 60))
4646
axs['patches'].set_aspect(1)
4747
plt.show()
4848

galleries/examples/showcase/xkcd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
ax.set_xticklabels(['CONFIRMED BY\nEXPERIMENT', 'REFUTED BY\nEXPERIMENT'])
5353
ax.set_xlim([-0.5, 1.5])
5454
ax.set_yticks([])
55-
ax.set_ylim([0, 110])
55+
ax.set_ylim((0, 110))
5656

5757
ax.set_title("CLAIMS OF SUPERNATURAL POWERS")
5858

galleries/examples/user_interfaces/fourier_demo_wx_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def createPlots(self):
195195
self.subplot2.set_ylabel("Time Domain Waveform x(t)", fontsize=8)
196196
self.subplot2.set_xlabel("time t", fontsize=8)
197197
self.subplot1.set_xlim([-6, 6])
198-
self.subplot1.set_ylim([0, 1])
198+
self.subplot1.set_ylim((0, 1))
199199
self.subplot2.set_xlim([-2, 2])
200200
self.subplot2.set_ylim([-2, 2])
201201
self.subplot1.text(0.05, .95,

galleries/users_explain/axes/axes_intro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Other important methods set the extent on the axes (`~.axes.Axes.set_xlim`, `~.a
143143
x = 2**np.cumsum(np.random.randn(200))
144144
linesx = ax.plot(t, x)
145145
ax.set_yscale('log')
146-
ax.set_xlim([20, 180])
146+
ax.set_xlim((20, 180))
147147

148148
The Axes class also has helpers to deal with Axis ticks and their labels. Most straight-forward is `~.axes.Axes.set_xticks` and `~.axes.Axes.set_yticks` which manually set the tick locations and optionally their labels. Minor ticks can be toggled with `~.axes.Axes.minorticks_on` or `~.axes.Axes.minorticks_off`.
149149

galleries/users_explain/axes/axes_scales.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def inverse(a):
171171
ax.set_yscale('function', functions=(forward, inverse))
172172
ax.set_title('function: Mercator')
173173
ax.grid(True)
174-
ax.set_xlim([0, 180])
174+
ax.set_xlim((0, 180))
175175
ax.yaxis.set_minor_formatter(NullFormatter())
176176
ax.yaxis.set_major_locator(FixedLocator(np.arange(0, 90, 10)))
177177

lib/matplotlib/tests/test_arrow_patches.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def __prepare_fancyarrow_dpi_cor_test():
5959
"""
6060
fig2 = plt.figure("fancyarrow_dpi_cor_test", figsize=(4, 3), dpi=50)
6161
ax = fig2.add_subplot()
62-
ax.set_xlim([0, 1])
63-
ax.set_ylim([0, 1])
62+
ax.set_xlim((0, 1))
63+
ax.set_ylim((0, 1))
6464
ax.add_patch(mpatches.FancyArrowPatch(posA=(0.3, 0.4), posB=(0.8, 0.6),
6565
lw=3, arrowstyle='->',
6666
mutation_scale=100))

lib/matplotlib/tests/test_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7538,8 +7538,8 @@ def test_zoom_inset():
75387538
axin1 = ax.inset_axes([0.7, 0.7, 0.35, 0.35])
75397539
# redraw the data in the inset axes...
75407540
axin1.pcolormesh(x, y, z[:-1, :-1])
7541-
axin1.set_xlim([1.5, 2.15])
7542-
axin1.set_ylim([2, 2.5])
7541+
axin1.set_xlim((1.5, 2.15))
7542+
axin1.set_ylim((2, 2.5))
75437543
axin1.set_aspect(ax.get_aspect())
75447544

75457545
rec, connectors = ax.indicate_inset_zoom(axin1)

lib/matplotlib/tests/test_axis.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ def test_axis_not_in_layout():
1515
fig2, (ax2_left, ax2_right) = plt.subplots(ncols=2, layout='constrained')
1616

1717
# 100 label overlapping the end of the axis
18-
ax1_left.set_xlim([0, 100])
18+
ax1_left.set_xlim((0, 100))
1919
# 100 label not overlapping the end of the axis
20-
ax2_left.set_xlim([0, 120])
20+
ax2_left.set_xlim((0, 120))
2121

2222
for ax in ax1_left, ax2_left:
2323
ax.set_xticks([0, 100])
1241

lib/matplotlib/tests/test_colorbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ def test_colorbar_change_lim_scale():
844844

845845
pc = ax[1].pcolormesh(np.arange(100).reshape(10, 10)+1)
846846
cb = fig.colorbar(pc, ax=ax[1], extend='both')
847-
cb.ax.set_ylim([20, 90])
847+
cb.ax.set_ylim((20, 90))
848848

849849

850850
@check_figures_equal(extensions=["png"])

lib/matplotlib/tests/test_image.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ def test_imshow_zoom(fig_test, fig_ref):
114114
fig.set_size_inches(2.9, 2.9)
115115
ax = fig_test.subplots()
116116
ax.imshow(A, interpolation='auto')
117-
ax.set_xlim([10, 20])
118-
ax.set_ylim([10, 20])
117+
ax.set_xlim((10, 20))
118+
ax.set_ylim((10, 20))
119119
ax = fig_ref.subplots()
120120
ax.imshow(A, interpolation='nearest')
121-
ax.set_xlim([10, 20])
122-
ax.set_ylim([10, 20])
121+
ax.set_xlim((10, 20))
122+
ax.set_ylim((10, 20))
123123

124124

125125
@check_figures_equal()
@@ -511,7 +511,7 @@ def test_image_composite_background():
511511
ax.imshow(arr, extent=[0, 2, 15, 0])
512512
ax.imshow(arr, extent=[4, 6, 15, 0])
513513
ax.set_facecolor((1, 0, 0, 0.5))
514-
ax.set_xlim([0, 12])
514+
ax.set_xlim((0, 12))
515515

516516

517517
@image_comparison(['image_composite_alpha'], remove_text=True)
@@ -537,8 +537,8 @@ def test_image_composite_alpha():
537537
ax.imshow(arr2, extent=[0, 5, 2, 3], alpha=0.6)
538538
ax.imshow(arr2, extent=[0, 5, 3, 4], alpha=0.3)
539539
ax.set_facecolor((0, 0.5, 0, 1))
540-
ax.set_xlim([0, 5])
541-
ax.set_ylim([5, 0])
540+
ax.set_xlim((0, 5))
541+
ax.set_ylim((5, 0))
542542

543543

544544
@check_figures_equal(extensions=["pdf"])

lib/matplotlib/tests/test_lines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def test_marker_fill_styles():
220220
markeredgecolor=color,
221221
markeredgewidth=2)
222222

223-
ax.set_ylim([0, 7.5])
223+
ax.set_ylim((0, 7.5))
224224
ax.set_xlim([-5, 155])
225225

226226

lib/matplotlib/tests/test_text.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ def test_multiline2():
144144

145145
fig, ax = plt.subplots()
146146

147-
ax.set_xlim([0, 1.4])
148-
ax.set_ylim([0, 2])
147+
ax.set_xlim((0, 1.4))
148+
ax.set_ylim((0, 2))
149149
ax.axhline(0.5, color='C2', linewidth=0.3)
150150
sts = ['Line', '2 Lineg\n 2 Lg', '$\\sum_i x $', 'hi $\\sum_i x $\ntest',
151151
'test\n $\\sum_i x $', '$\\sum_i x $\n $\\sum_i x $']

lib/matplotlib/tests/test_tightlayout.py

Lines changed: 2 additions & 2 deletions
7B91
Original file line numberDiff line numberDiff line change
@@ -296,8 +296,8 @@ def test_collapsed():
296296
# zero (i.e. margins add up to more than the available width) that a call
297297
# to tight_layout will not get applied:
298298
fig, ax = plt.subplots(tight_layout=True)
299-
ax.set_xlim([0, 1])
300-
ax.set_ylim([0, 1])
299+
ax.set_xlim((0, 1))
300+
ax.set_ylim((0, 1))
301301

302302
ax.annotate('BIG LONG STRING', xy=(1.25, 2), xytext=(10.5, 1.75),
303303
annotation_clip=False)

0 commit comments

Comments
 (0)
0