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

Appearance settings

Commit a8d1469

Browse filesBrowse files
committed
Apply isort to tutorials
1 parent 9771b71 commit a8d1469
Copy full SHA for a8d1469
Expand file treeCollapse file tree

26 files changed

+64
-33
lines changed

‎.pre-commit-config.yaml

Copy file name to clipboardExpand all lines: .pre-commit-config.yaml
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,10 @@ repos:
4141
"--skip",
4242
"doc/users/project/credits.rst"
4343
]
44+
- repo: https://github.com/pycqa/isort
45+
rev: 5.11.2
46+
hooks:
47+
- id: isort
48+
name: isort (python)
49+
args: ['--force-sort-within-sections', 'true']
50+
files: ^tutorials/

‎tutorials/advanced/blitting.py

Copy file name to clipboardExpand all lines: tutorials/advanced/blitting.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@
5454
5555
"""
5656

57-
import matplotlib.pyplot as plt
5857
import numpy as np
5958

59+
import matplotlib.pyplot as plt
60+
6061
x = np.linspace(0, 2 * np.pi, 100)
6162

6263
fig, ax = plt.subplots()

‎tutorials/advanced/path_tutorial.py

Copy file name to clipboardExpand all lines: tutorials/advanced/path_tutorial.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
could use this code:
1515
"""
1616

17-
import matplotlib.pyplot as plt
18-
from matplotlib.path import Path
1917
import matplotlib.patches as patches
18+
from matplotlib.path import Path
19+
import matplotlib.pyplot as plt
2020

2121
verts = [
2222
(0., 0.), # left, bottom
@@ -187,6 +187,7 @@
187187
# ax.add_patch(patch)
188188

189189
import numpy as np
190+
190191
import matplotlib.patches as patches
191192
import matplotlib.path as path
192193

‎tutorials/advanced/patheffects_guide.py

Copy file name to clipboardExpand all lines: tutorials/advanced/patheffects_guide.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
without any effect:
2020
"""
2121

22-
import matplotlib.pyplot as plt
2322
import matplotlib.patheffects as path_effects
23+
import matplotlib.pyplot as plt
2424

2525
fig = plt.figure(figsize=(5, 1.5))
2626
text = fig.text(0.5, 0.5, 'Hello path effects world!\nThis is the normal '

‎tutorials/advanced/transforms_tutorial.py

Copy file name to clipboardExpand all lines: tutorials/advanced/transforms_tutorial.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@
113113
"""
114114

115115
import numpy as np
116-
import matplotlib.pyplot as plt
116+
117117
import matplotlib.patches as mpatches
118+
import matplotlib.pyplot as plt
118119

119120
x = np.arange(0, 10, 0.005)
120121
y = np.exp(-x/2.) * np.sin(2*np.pi*x)

‎tutorials/colors/colorbar_only.py

Copy file name to clipboardExpand all lines: tutorials/colors/colorbar_only.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
For more information see the :mod:`~matplotlib.colorbar` API.
2727
"""
2828

29-
import matplotlib.pyplot as plt
3029
import matplotlib as mpl
30+
import matplotlib.pyplot as plt
3131

3232
fig, ax = plt.subplots(figsize=(6, 1))
3333
fig.subplots_adjust(bottom=0.5)

‎tutorials/colors/colormap-manipulation.py

Copy file name to clipboardExpand all lines: tutorials/colors/colormap-manipulation.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@
3232
"""
3333

3434
import numpy as np
35-
import matplotlib.pyplot as plt
35+
3636
import matplotlib as mpl
37-
from matplotlib.colors import ListedColormap, LinearSegmentedColormap
37+
from matplotlib.colors import LinearSegmentedColormap, ListedColormap
38+
import matplotlib.pyplot as plt
3839

3940
viridis = mpl.colormaps['viridis'].resampled(8)
4041

‎tutorials/colors/colormapnorms.py

Copy file name to clipboardExpand all lines: tutorials/colors/colormapnorms.py
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@
4242
4343
"""
4444
import numpy as np
45-
import matplotlib.pyplot as plt
46-
import matplotlib.colors as colors
47-
import matplotlib.cbook as cbook
45+
4846
from matplotlib import cm
47+
import matplotlib.cbook as cbook
48+
import matplotlib.colors as colors
49+
import matplotlib.pyplot as plt
4950

5051
N = 100
5152
X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]

‎tutorials/colors/colormaps.py

Copy file name to clipboardExpand all lines: tutorials/colors/colormaps.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@
7777

7878
# sphinx_gallery_thumbnail_number = 2
7979

80+
from colorspacious import cspace_converter
8081
import numpy as np
82+
8183
import matplotlib as mpl
8284
import matplotlib.pyplot as plt
83-
from colorspacious import cspace_converter
84-
8585

8686
# %%
8787
#

‎tutorials/colors/colors.py

Copy file name to clipboardExpand all lines: tutorials/colors/colors.py
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,11 @@
9494
The following plot illustrates the effect of transparency.
9595
"""
9696

97-
import matplotlib.pyplot as plt
98-
from matplotlib.patches import Rectangle
9997
import numpy as np
10098

99+
from matplotlib.patches import Rectangle
100+
import matplotlib.pyplot as plt
101+
101102
fig, ax = plt.subplots(figsize=(6.5, 1.65), layout='constrained')
102103
ax.add_patch(Rectangle((-0.2, -0.35), 11.2, 0.7, color='C1', alpha=0.8))
103104
for i, alpha in enumerate(np.linspace(0, 1, 11)):
@@ -131,8 +132,9 @@
131132

132133

133134
import numpy as np
134-
import matplotlib.pyplot as plt
135+
135136
import matplotlib as mpl
137+
import matplotlib.pyplot as plt
136138

137139
th = np.linspace(0, 2*np.pi, 128)
138140

‎tutorials/intermediate/arranging_axes.py

Copy file name to clipboardExpand all lines: tutorials/intermediate/arranging_axes.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,10 @@
9797
# we use `~.Axes.annotate`, but other examples could be `~.Axes.plot`,
9898
# `~.Axes.pcolormesh`, etc.
9999

100-
import matplotlib.pyplot as plt
101100
import numpy as np
102101

102+
import matplotlib.pyplot as plt
103+
103104
fig, axs = plt.subplots(ncols=2, nrows=2, figsize=(5.5, 3.5),
104105
layout="constrained")
105106
# add an artist, in this case a nice label in the middle...

‎tutorials/intermediate/artists.py

Copy file name to clipboardExpand all lines: tutorials/intermediate/artists.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ class in the Matplotlib API, and the one you will be working with most
115115
# sphinx_gallery_capture_repr = ('__repr__',)
116116

117117
import numpy as np
118+
118119
import matplotlib.pyplot as plt
119120

120121
fig = plt.figure()

‎tutorials/intermediate/autoscale.py

Copy file name to clipboardExpand all lines: tutorials/intermediate/autoscale.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# extends the axis limits 5% beyond the data limits (-2π, 2π).
1313

1414
import numpy as np
15+
1516
import matplotlib as mpl
1617
import matplotlib.pyplot as plt
1718

‎tutorials/intermediate/color_cycle.py

Copy file name to clipboardExpand all lines: tutorials/intermediate/color_cycle.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"""
2121
from cycler import cycler
2222
import numpy as np
23+
2324
import matplotlib.pyplot as plt
2425

2526
# %%

‎tutorials/intermediate/constrainedlayout_guide.py

Copy file name to clipboardExpand all lines: tutorials/intermediate/constrainedlayout_guide.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@
4141
# sphinx_gallery_thumbnail_number = 18
4242

4343

44-
import matplotlib.pyplot as plt
44+
import numpy as np
45+
4546
import matplotlib.colors as mcolors
4647
import matplotlib.gridspec as gridspec
47-
import numpy as np
48+
import matplotlib.pyplot as plt
4849

4950
plt.rcParams['savefig.facecolor'] = "0.8"
5051
plt.rcParams['figure.figsize'] = 4.5, 4.

‎tutorials/intermediate/imshow_extent.py

Copy file name to clipboardExpand all lines: tutorials/intermediate/imshow_extent.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
directly continue with the discussion of the results.
2424
"""
2525
import numpy as np
26-
import matplotlib.pyplot as plt
26+
2727
from matplotlib.gridspec import GridSpec
28+
import matplotlib.pyplot as plt
2829

2930

3031
def index_to_coordinate(index, extent, origin):

‎tutorials/intermediate/tight_layout_guide.py

Copy file name to clipboardExpand all lines: tutorials/intermediate/tight_layout_guide.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@
2626

2727
# sphinx_gallery_thumbnail_number = 7
2828

29-
import matplotlib.pyplot as plt
3029
import numpy as np
3130

31+
import matplotlib.pyplot as plt
32+
3233
plt.rcParams['savefig.facecolor'] = "0.8"
3334

3435

‎tutorials/introductory/animation_tutorial.py

Copy file name to clipboardExpand all lines: tutorials/introductory/animation_tutorial.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
how to create such animations and the different options available.
1111
"""
1212

13-
import matplotlib.pyplot as plt
14-
import matplotlib.animation as animation
1513
import numpy as np
1614

15+
import matplotlib.animation as animation
16+
import matplotlib.pyplot as plt
17+
1718
# %%
1819
# Animation Classes
1920
# =================

‎tutorials/introductory/customizing.py

Copy file name to clipboardExpand all lines: tutorials/introductory/customizing.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@
2929
rcParams can be modified directly, for example:
3030
"""
3131

32+
from cycler import cycler
3233
import numpy as np
33-
import matplotlib.pyplot as plt
34+
3435
import matplotlib as mpl
35-
from cycler import cycler
36+
import matplotlib.pyplot as plt
37+
3638
mpl.rcParams['lines.linewidth'] = 2
3739
mpl.rcParams['lines.linestyle'] = '--'
3840
data = np.random.randn(50)

‎tutorials/introductory/images.py

Copy file name to clipboardExpand all lines: tutorials/introductory/images.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@
4848
4949
"""
5050

51-
import matplotlib.pyplot as plt
52-
import numpy as np
5351
from PIL import Image
52+
import numpy as np
53+
54+
import matplotlib.pyplot as plt
5455

5556
# %%
5657
# .. _importing_data:

‎tutorials/introductory/lifecycle.py

Copy file name to clipboardExpand all lines: tutorials/introductory/lifecycle.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656

5757
# sphinx_gallery_thumbnail_number = 10
5858
import numpy as np
59-
import matplotlib.pyplot as plt
6059

60+
import matplotlib.pyplot as plt
6161

6262
data = {'Barton LLC': 109438.50,
6363
'Frami, Hills and Schmidt': 103569.59,

‎tutorials/introductory/pyplot.py

Copy file name to clipboardExpand all lines: tutorials/introductory/pyplot.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
# Generating visualizations with pyplot is very quick:
3939

4040
import matplotlib.pyplot as plt
41+
4142
plt.plot([1, 2, 3, 4])
4243
plt.ylabel('some numbers')
4344
plt.show()

‎tutorials/introductory/quick_start.py

Copy file name to clipboardExpand all lines: tutorials/introductory/quick_start.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
1111
"""
1212

13+
import numpy as np
14+
1315
# sphinx_gallery_thumbnail_number = 3
1416
import matplotlib as mpl
1517
import matplotlib.pyplot as plt
16-
import numpy as np
1718

1819
# %%
1920
#

‎tutorials/text/annotations.py

Copy file name to clipboardExpand all lines: tutorials/text/annotations.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
# of these arguments are ``(x, y)`` tuples:
2626

2727
import numpy as np
28+
2829
import matplotlib.pyplot as plt
2930

3031
fig, ax = plt.subplots(figsize=(3, 3))
@@ -443,9 +444,10 @@ def custom_box_style(x0, y0, width, height, mutation_size):
443444
# artists are interpreted as a pixel coordinate, i.e., the radius of the
444445
# circles in above example are 10 pixels and 5 pixels, respectively.
445446

446-
from matplotlib.patches import Circle
447447
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDrawingArea
448448

449+
from matplotlib.patches import Circle
450+
449451
fig, ax = plt.subplots(figsize=(3, 3))
450452
ada = AnchoredDrawingArea(40, 20, 0, 0,
451453
loc='upper right', pad=0., frameon=False)
@@ -468,9 +470,10 @@ def custom_box_style(x0, y0, width, height, mutation_size):
468470
# corresponding to 0.1 and 0.4 in data coordinates and will be
469471
# automatically scaled when the view limits of the axes change.
470472

471-
from matplotlib.patches import Ellipse
472473
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredAuxTransformBox
473474

475+
from matplotlib.patches import Ellipse
476+
474477
fig, ax = plt.subplots(figsize=(3, 3))
475478
box = AnchoredAuxTransformBox(ax.transData, loc='upper left')
476479
el = Ellipse((0, 0), width=0.1, height=0.4, angle=30) # in data coordinates!

‎tutorials/text/text_intro.py

Copy file name to clipboardExpand all lines: tutorials/text/text_intro.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@
109109
# `~matplotlib.axes.Axes.set_xlabel` and `~matplotlib.axes.Axes.set_ylabel`
110110
# methods.
111111

112-
import matplotlib.pyplot as plt
113112
import numpy as np
114113

114+
import matplotlib.pyplot as plt
115+
115116
x1 = np.linspace(0.0, 5.0, 100)
116117
y1 = np.cos(2 * np.pi * x1) * np.exp(-x1)
117118

‎tutorials/text/text_props.py

Copy file name to clipboardExpand all lines: tutorials/text/text_props.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
upper right.
6060
"""
6161

62-
import matplotlib.pyplot as plt
6362
import matplotlib.patches as patches
63+
import matplotlib.pyplot as plt
6464

6565
# build a rectangle in axes coords
6666
left, width = .25, .5

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.