Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf797268

Browse files
oscargusQuLogic
authored andcommitted
Change first argument to add_axes from list to tuple
1 parenta7b4a8b commitf797268

File tree

44 files changed

+93
-93
lines changed

Some content is hidden

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

44 files changed

+93
-93
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/whats_new_3.5.0.rst

Lines changed: 3 additions & 3 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
--------------------------------------------

‎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/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
frommpl_toolkits.axes_grid1.axes_dividerimportmake_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/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')

‎galleries/examples/images_contours_and_fields/image_antialiasing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
# may serve a 100x100 version of the image, which will be downsampled.)
246246

247247
fig=plt.figure(figsize=(2,2))
248-
ax=fig.add_axes([0,0,1,1])
248+
ax=fig.add_axes((0,0,1,1))
249249
ax.imshow(aa[:400, :400],cmap='RdBu_r',interpolation='nearest')
250250
plt.show()
251251
# %%

‎galleries/examples/images_contours_and_fields/image_exact_placement.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ def annotate_rect(ax):
134134
fig=plt.figure(figsize=(fig_width/dpi,fig_height/dpi),facecolor='aliceblue')
135135

136136
# the position posA must be normalized by the figure width and height:
137-
ax=fig.add_axes([posA[0]/fig_width,posA[1]/fig_height,
138-
posA[2]/fig_width,posA[3]/fig_height])
137+
ax=fig.add_axes((posA[0]/fig_width,posA[1]/fig_height,
138+
posA[2]/fig_width,posA[3]/fig_height))
139139
ax.imshow(A,vmin=-1,vmax=1)
140140
annotate_rect(ax)
141141

142-
ax=fig.add_axes([posB[0]/fig_width,posB[1]/fig_height,
143-
posB[2]/fig_width,posB[3]/fig_height])
142+
ax=fig.add_axes((posB[0]/fig_width,posB[1]/fig_height,
143+
posB[2]/fig_width,posB[3]/fig_height))
144144
ax.imshow(B,vmin=-1,vmax=1)
145145
plt.show()
146146
# %%

‎galleries/examples/misc/svg_filter_line.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
importmatplotlib.transformsasmtransforms
1818

1919
fig1=plt.figure()
20-
ax=fig1.add_axes([0.1,0.1,0.8,0.8])
20+
ax=fig1.add_axes((0.1,0.1,0.8,0.8))
2121

2222
# draw lines
2323
l1,=ax.plot([0.1,0.5,0.9], [0.1,0.9,0.5],"bo-",

‎galleries/examples/misc/svg_filter_pie.py

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

2020
# make a square figure and Axes
2121
fig=plt.figure(figsize=(6,6))
22-
ax=fig.add_axes([0.1,0.1,0.8,0.8])
22+
ax=fig.add_axes((0.1,0.1,0.8,0.8))
2323

2424
labels='Frogs','Hogs','Dogs','Logs'
2525
fracs= [15,30,45,10]

‎galleries/examples/showcase/anatomy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
Y3=np.random.uniform(Y1,Y2,len(X))
2828

2929
fig=plt.figure(figsize=(7.5,7.5))
30-
ax=fig.add_axes([0.2,0.17,0.68,0.7],aspect=1)
30+
ax=fig.add_axes((0.2,0.17,0.68,0.7),aspect=1)
3131

3232
ax.xaxis.set_major_locator(MultipleLocator(1.000))
3333
ax.xaxis.set_minor_locator(AutoMinorLocator(4))

‎galleries/examples/showcase/firefox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def svg_parse(path):
4848
xmax,ymax=verts.max(axis=0)+1
4949

5050
fig=plt.figure(figsize=(5,5),facecolor="0.75")# gray background
51-
ax=fig.add_axes([0,0,1,1],frameon=False,aspect=1,
51+
ax=fig.add_axes((0,0,1,1),frameon=False,aspect=1,
5252
xlim=(xmin,xmax),# centering
5353
ylim=(ymax,ymin),# centering, upside down
5454
xticks=[],yticks=[])# no ticks

‎galleries/examples/showcase/mandelbrot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def mandelbrot_set(xmin, xmax, ymin, ymax, xn, yn, maxiter, horizon=2.0):
5555
width=10
5656
height=10*yn/xn
5757
fig=plt.figure(figsize=(width,height),dpi=dpi)
58-
ax=fig.add_axes([0,0,1,1],frameon=False,aspect=1)
58+
ax=fig.add_axes((0,0,1,1),frameon=False,aspect=1)
5959

6060
# Shaded rendering
6161
light=colors.LightSource(azdeg=315,altdeg=10)

‎galleries/examples/subplots_axes_and_figures/axes_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
main_ax.set_title('Gaussian colored noise')
3434

3535
# this is an inset Axes over the main Axes
36-
right_inset_ax=fig.add_axes([.65,.6,.2,.2],facecolor='k')
36+
right_inset_ax=fig.add_axes((.65,.6,.2,.2),facecolor='k')
3737
right_inset_ax.hist(s,400,density=True)
3838
right_inset_ax.set(title='Probability',xticks=[],yticks=[])
3939

4040
# this is another inset Axes over the main Axes
41-
left_inset_ax=fig.add_axes([.2,.6,.2,.2],facecolor='k')
41+
left_inset_ax=fig.add_axes((.2,.6,.2,.2),facecolor='k')
4242
left_inset_ax.plot(t[:len(r)],r)
4343
left_inset_ax.set(title='Impulse response',xlim=(0,.2),xticks=[],yticks=[])
4444

‎galleries/examples/text_labels_and_annotations/mathtext_examples.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def doall():
6161

6262
# Creating figure and axis.
6363
fig=plt.figure(figsize=(7,7))
64-
ax=fig.add_axes([0.01,0.01,0.98,0.90],
64+
ax=fig.add_axes((0.01,0.01,0.98,0.90),
6565
facecolor="white",frameon=True)
6666
ax.set_xlim(0,1)
6767
ax.set_ylim(0,1)

‎galleries/examples/ticks/fig_axes_customize_simple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
fig=plt.figure()
1414
fig.patch.set_facecolor('lightgoldenrodyellow')
1515

16-
ax1=fig.add_axes([0.1,0.3,0.4,0.4])
16+
ax1=fig.add_axes((0.1,0.3,0.4,0.4))
1717
ax1.patch.set_facecolor('lightslategray')
1818

1919
ax1.tick_params(axis='x',labelcolor='tab:red',labelrotation=45,labelsize=16)

‎galleries/examples/widgets/buttons.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def prev(self, event):
4141
plt.draw()
4242

4343
callback=Index()
44-
axprev=fig.add_axes([0.7,0.05,0.1,0.075])
45-
axnext=fig.add_axes([0.81,0.05,0.1,0.075])
44+
axprev=fig.add_axes((0.7,0.05,0.1,0.075))
45+
axnext=fig.add_axes((0.81,0.05,0.1,0.075))
4646
bnext=Button(axnext,'Next')
4747
bnext.on_clicked(callback.next)
4848
bprev=Button(axprev,'Previous')

‎galleries/examples/widgets/range_slider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
axs[1].set_title('Histogram of pixel intensities')
3535

3636
# Create the RangeSlider
37-
slider_ax=fig.add_axes([0.20,0.1,0.60,0.03])
37+
slider_ax=fig.add_axes((0.20,0.1,0.60,0.03))
3838
slider=RangeSlider(slider_ax,"Threshold",img.min(),img.max())
3939

4040
# Create the Vertical lines on the histogram

‎galleries/examples/widgets/slider_demo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def f(t, amplitude, frequency):
3838
fig.subplots_adjust(left=0.25,bottom=0.25)
3939

4040
# Make a horizontal slider to control the frequency.
41-
axfreq=fig.add_axes([0.25,0.1,0.65,0.03])
41+
axfreq=fig.add_axes((0.25,0.1,0.65,0.03))
4242
freq_slider=Slider(
4343
ax=axfreq,
4444
label='Frequency [Hz]',
@@ -48,7 +48,7 @@ def f(t, amplitude, frequency):
4848
)
4949

5050
# Make a vertically oriented slider to control the amplitude
51-
axamp=fig.add_axes([0.1,0.25,0.0225,0.63])
51+
axamp=fig.add_axes((0.1,0.25,0.0225,0.63))
5252
amp_slider=Slider(
5353
ax=axamp,
5454
label="Amplitude",
@@ -70,7 +70,7 @@ def update(val):
7070
amp_slider.on_changed(update)
7171

7272
# Create a `matplotlib.widgets.Button` to reset the sliders to initial values.
73-
resetax=fig.add_axes([0.8,0.025,0.1,0.04])
73+
resetax=fig.add_axes((0.8,0.025,0.1,0.04))
7474
button=Button(resetax,'Reset',hovercolor='0.975')
7575

7676

‎galleries/examples/widgets/slider_snap_demo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
fig.subplots_adjust(bottom=0.25)
3131
l,=ax.plot(t,s,lw=2)
3232

33-
ax_freq=fig.add_axes([0.25,0.1,0.65,0.03])
34-
ax_amp=fig.add_axes([0.25,0.15,0.65,0.03])
33+
ax_freq=fig.add_axes((0.25,0.1,0.65,0.03))
34+
ax_amp=fig.add_axes((0.25,0.15,0.65,0.03))
3535

3636
# define the values to use for snapping
3737
allowed_amplitudes=np.concatenate([np.linspace(.1,5,100), [6,7,8,9]])
@@ -60,7 +60,7 @@ def update(val):
6060
sfreq.on_changed(update)
6161
samp.on_changed(update)
6262

63-
ax_reset=fig.add_axes([0.8,0.025,0.1,0.04])
63+
ax_reset=fig.add_axes((0.8,0.025,0.1,0.04))
6464
button=Button(ax_reset,'Reset',hovercolor='0.975')
6565

6666

‎galleries/examples/widgets/textbox.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def submit(expression):
3939
plt.draw()
4040

4141

42-
axbox=fig.add_axes([0.1,0.05,0.8,0.075])
42+
axbox=fig.add_axes((0.1,0.05,0.8,0.075))
4343
text_box=TextBox(axbox,"Evaluate",textalignment="center")
4444
text_box.on_submit(submit)
4545
text_box.set_val("t ** 2")# Trigger `submit` with the initial string.

‎galleries/tutorials/artists.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class in the Matplotlib API, and the one you will be working with most
7070
coordinates::
7171
7272
fig2 = plt.figure()
73-
ax2 = fig2.add_axes([0.15, 0.1, 0.7, 0.3])
73+
ax2 = fig2.add_axes((0.15, 0.1, 0.7, 0.3))
7474
7575
Continuing with our example::
7676
@@ -134,7 +134,7 @@ class in the Matplotlib API, and the one you will be working with most
134134
# Fixing random state for reproducibility
135135
np.random.seed(19680801)
136136

137-
ax2=fig.add_axes([0.15,0.1,0.7,0.3])
137+
ax2=fig.add_axes((0.15,0.1,0.7,0.3))
138138
n,bins,patches=ax2.hist(np.random.randn(1000),50,
139139
facecolor='yellow',edgecolor='yellow')
140140
ax2.set_xlabel('Time [s]')
@@ -295,7 +295,7 @@ class in the Matplotlib API, and the one you will be working with most
295295
#
296296
# In [157]: ax1 = fig.add_subplot(211)
297297
#
298-
# In [158]: ax2 = fig.add_axes([0.1, 0.1, 0.7, 0.3])
298+
# In [158]: ax2 = fig.add_axes((0.1, 0.1, 0.7, 0.3))
299299
#
300300
# In [159]: ax1
301301
# Out[159]: <Axes:>
@@ -669,7 +669,7 @@ class in the Matplotlib API, and the one you will be working with most
669669
rect=fig.patch# a rectangle instance
670670
rect.set_facecolor('lightgoldenrodyellow')
671671

672-
ax1=fig.add_axes([0.1,0.3,0.4,0.4])
672+
ax1=fig.add_axes((0.1,0.3,0.4,0.4))
673673
rect=ax1.patch
674674
rect.set_facecolor('lightslategray')
675675

‎galleries/users_explain/axes/arranging_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@
103103
w,h=4,3
104104
margin=0.5
105105
fig=plt.figure(figsize=(w,h),facecolor='lightblue')
106-
ax=fig.add_axes([margin/w,margin/h, (w-2*margin)/w,
107-
(h-2*margin)/h])
106+
ax=fig.add_axes((margin/w,margin/h,
107+
(w-2*margin)/w,(h-2*margin)/h))
108108

109109

110110
# %%

‎galleries/users_explain/axes/axes_intro.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ Axes are added using methods on `~.Figure` objects, or via the `~.pyplot` interf
5252

5353
There are a number of other methods for adding Axes to a Figure:
5454

55-
* `.Figure.add_axes`: manually position an Axes. ``fig.add_axes([0, 0, 1,
56-
1])`` makes anAxes that fills the whole figure.
55+
* `.Figure.add_axes`: manually position an Axes. ``fig.add_axes((0, 0, 1, 1))`` makes an
56+
Axes that fills the whole figure.
5757
* `.pyplot.subplots` and `.Figure.subplots`: add a grid of Axes as in the example
5858
above. The pyplot version returns both the Figure object and an array of
5959
Axes. Note that ``fig, ax = plt.subplots()`` adds a single Axes to a Figure.

‎galleries/users_explain/colors/colors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def demo(sty):
197197
iff'xkcd:{name}'inmcolors.XKCD_COLORS}
198198

199199
fig=plt.figure(figsize=[9,5])
200-
ax=fig.add_axes([0,0,1,1])
200+
ax=fig.add_axes((0,0,1,1))
201201

202202
n_groups=3
203203
n_rows=len(overlap)//n_groups+1

‎galleries/users_explain/text/text_props.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
top=bottom+height
7676

7777
fig=plt.figure()
78-
ax=fig.add_axes([0,0,1,1])
78+
ax=fig.add_axes((0,0,1,1))
7979

8080
# axes coordinates: (0, 0) is bottom left and (1, 1) is upper right
8181
p=patches.Rectangle(

‎galleries/users_explain/toolkits/axisartist.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ To create an Axes, ::
5050

5151
import mpl_toolkits.axisartist as AA
5252
fig = plt.figure()
53-
fig.add_axes([0.1, 0.1, 0.8, 0.8], axes_class=AA.Axes)
53+
fig.add_axes((0.1, 0.1, 0.8, 0.8), axes_class=AA.Axes)
5454

5555
or to create a subplot ::
5656

‎lib/matplotlib/_enums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def demo():
151151
importmatplotlib.pyplotasplt
152152

153153
fig=plt.figure(figsize=(4,1.2))
154-
ax=fig.add_axes([0,0,1,0.8])
154+
ax=fig.add_axes((0,0,1,0.8))
155155
ax.set_title('Cap style')
156156

157157
forx,styleinenumerate(['butt','round','projecting']):

‎lib/matplotlib/figure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3678,15 +3678,15 @@ def figaspect(arg):
36783678
36793679
w, h = figaspect(2.)
36803680
fig = Figure(figsize=(w, h))
3681-
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
3681+
ax = fig.add_axes((0.1, 0.1, 0.8, 0.8))
36823682
ax.imshow(A, **kwargs)
36833683
36843684
Make a figure with the proper aspect for an array::
36853685
36863686
A = rand(5, 3)
36873687
w, h = figaspect(A)
36883688
fig = Figure(figsize=(w, h))
3689-
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
3689+
ax = fig.add_axes((0.1, 0.1, 0.8, 0.8))
36903690
ax.imshow(A, **kwargs)
36913691
"""
36923692

‎lib/matplotlib/image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,7 @@ def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear',
17721772
fig=Figure(figsize=(width,height),dpi=dpi)
17731773
FigureCanvasBase(fig)
17741774

1775-
ax=fig.add_axes([0,0,1,1],aspect='auto',
1775+
ax=fig.add_axes((0,0,1,1),aspect='auto',
17761776
frameon=False,xticks=[],yticks=[])
17771777
ax.imshow(im,aspect='auto',resample=True,interpolation=interpolation)
17781778
fig.savefig(thumbfile,dpi=dpi)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp