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

Commitad0a4c0

Browse files
authored
Merge pull request#23796 from gustavi/gustavi-patch-1
Remove useless semicolons in "Introductory / Basic Usage" tutorial
2 parents2d18bba +aa21d1c commitad0a4c0

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

‎tutorials/introductory/quick_start.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# `.Axes.plot` to draw some data on the Axes:
2929

3030
fig,ax=plt.subplots()# Create a figure containing a single axes.
31-
ax.plot([1,2,3,4], [1,4,2,3]);# Plot some data on the axes.
31+
ax.plot([1,2,3,4], [1,4,2,3])# Plot some data on the axes.
3232

3333
###############################################################################
3434
# .. _figure_parts:
@@ -126,7 +126,7 @@
126126
fig,ax=plt.subplots(figsize=(5,2.7),layout='constrained')
127127
ax.scatter('a','b',c='c',s='d',data=data)
128128
ax.set_xlabel('entry a')
129-
ax.set_ylabel('entry b');
129+
ax.set_ylabel('entry b')
130130

131131
##############################################################################
132132
# .. _coding_styles:
@@ -159,7 +159,7 @@
159159
ax.set_xlabel('x label')# Add an x-label to the axes.
160160
ax.set_ylabel('y label')# Add a y-label to the axes.
161161
ax.set_title("Simple Plot")# Add a title to the axes.
162-
ax.legend();# Add a legend.
162+
ax.legend()# Add a legend.
163163

164164
###############################################################################
165165
# or the pyplot-style:
@@ -173,7 +173,7 @@
173173
plt.xlabel('x label')
174174
plt.ylabel('y label')
175175
plt.title("Simple Plot")
176-
plt.legend();
176+
plt.legend()
177177

178178
###############################################################################
179179
# (In addition, there is a third approach, for the case when embedding
@@ -213,7 +213,7 @@ def my_plotter(ax, data1, data2, param_dict):
213213
data1,data2,data3,data4=np.random.randn(4,100)# make 4 random data sets
214214
fig, (ax1,ax2)=plt.subplots(1,2,figsize=(5,2.7))
215215
my_plotter(ax1,data1,data2, {'marker':'x'})
216-
my_plotter(ax2,data3,data4, {'marker':'o'});
216+
my_plotter(ax2,data3,data4, {'marker':'o'})
217217

218218
###############################################################################
219219
# Note that if you want to install these as a python package, or any other
@@ -235,7 +235,7 @@ def my_plotter(ax, data1, data2, param_dict):
235235
x=np.arange(len(data1))
236236
ax.plot(x,np.cumsum(data1),color='blue',linewidth=3,linestyle='--')
237237
l,=ax.plot(x,np.cumsum(data2),color='orange',linewidth=2)
238-
l.set_linestyle(':');
238+
l.set_linestyle(':')
239239

240240
###############################################################################
241241
# Colors
@@ -248,7 +248,7 @@ def my_plotter(ax, data1, data2, param_dict):
248248
# from the interior:
249249

250250
fig,ax=plt.subplots(figsize=(5,2.7))
251-
ax.scatter(data1,data2,s=50,facecolor='C0',edgecolor='k');
251+
ax.scatter(data1,data2,s=50,facecolor='C0',edgecolor='k')
252252

253253
###############################################################################
254254
# Linewidths, linestyles, and markersizes
@@ -272,7 +272,7 @@ def my_plotter(ax, data1, data2, param_dict):
272272
ax.plot(data2,'d',label='data2')
273273
ax.plot(data3,'v',label='data3')
274274
ax.plot(data4,'s',label='data4')
275-
ax.legend();
275+
ax.legend()
276276

277277
###############################################################################
278278
#
@@ -298,7 +298,7 @@ def my_plotter(ax, data1, data2, param_dict):
298298
ax.set_title('Aardvark lengths\n (not really)')
299299
ax.text(75,.025,r'$\mu=115,\ \sigma=15$')
300300
ax.axis([55,175,0,0.03])
301-
ax.grid(True);
301+
ax.grid(True)
302302

303303
###############################################################################
304304
# All of the `~.Axes.text` functions return a `matplotlib.text.Text`
@@ -342,7 +342,7 @@ def my_plotter(ax, data1, data2, param_dict):
342342
ax.annotate('local max',xy=(2,1),xytext=(3,1.5),
343343
arrowprops=dict(facecolor='black',shrink=0.05))
344344

345-
ax.set_ylim(-2,2);
345+
ax.set_ylim(-2,2)
346346

347347
###############################################################################
348348
# In this basic example, both *xy* and *xytext* are in data coordinates.
@@ -360,7 +360,7 @@ def my_plotter(ax, data1, data2, param_dict):
360360
ax.plot(np.arange(len(data1)),data1,label='data1')
361361
ax.plot(np.arange(len(data2)),data2,label='data2')
362362
ax.plot(np.arange(len(data3)),data3,'d',label='data3')
363-
ax.legend();
363+
ax.legend()
364364

365365
##############################################################################
366366
# Legends in Matplotlib are quite flexible in layout, placement, and what
@@ -391,7 +391,7 @@ def my_plotter(ax, data1, data2, param_dict):
391391
axs[0].plot(xdata,data)
392392

393393
axs[1].set_yscale('log')
394-
axs[1].plot(xdata,data);
394+
axs[1].plot(xdata,data)
395395

396396
##############################################################################
397397
# The scale sets the mapping from data values to spacing along the Axis. This
@@ -413,7 +413,7 @@ def my_plotter(ax, data1, data2, param_dict):
413413
axs[1].plot(xdata,data1)
414414
axs[1].set_xticks(np.arange(0,100,30), ['zero','30','sixty','90'])
415415
axs[1].set_yticks([-1.5,0,1.5])# note that we don't need to specify labels
416-
axs[1].set_title('Manual ticks');
416+
axs[1].set_title('Manual ticks')
417417

418418
##############################################################################
419419
# Different scales can have different locators and formatters; for instance
@@ -435,7 +435,7 @@ def my_plotter(ax, data1, data2, param_dict):
435435
data=np.cumsum(np.random.randn(len(dates)))
436436
ax.plot(dates,data)
437437
cdf=mpl.dates.ConciseDateFormatter(ax.xaxis.get_major_locator())
438-
ax.xaxis.set_major_formatter(cdf);
438+
ax.xaxis.set_major_formatter(cdf)
439439

440440
##############################################################################
441441
# For more information see the date examples
@@ -447,7 +447,7 @@ def my_plotter(ax, data1, data2, param_dict):
447447
fig,ax=plt.subplots(figsize=(5,2.7),layout='constrained')
448448
categories= ['turnips','rutabaga','cucumber','pumpkins']
449449

450-
ax.bar(categories,np.random.rand(len(categories)));
450+
ax.bar(categories,np.random.rand(len(categories)))
451451

452452
##############################################################################
453453
# One caveat about categorical plotting is that some methods of parsing
@@ -561,7 +561,7 @@ def my_plotter(ax, data1, data2, param_dict):
561561
['lowleft','right']],layout='constrained')
562562
axd['upleft'].set_title('upleft')
563563
axd['lowleft'].set_title('lowleft')
564-
axd['right'].set_title('right');
564+
axd['right'].set_title('right')
565565

566566
###############################################################################
567567
# Matplotlib has quite sophisticated tools for arranging Axes: See

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp