Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f757e7

Browse files
committed
Move pyplot import next to numpy
1 parent 1089ec4 commit 9f757e7

File tree

475 files changed

+385
-492
lines changed

Some content is hidden

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

475 files changed

+385
-492
lines changed

.isort.cfg

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
[settings]
22
known_mpltoolkits = mpl_toolkits
3-
known_first_party = matplotlib
4-
sections=FUTURE,STDLIB,THIRDPARTY,MPLTOOLKITS,FIRSTPARTY,LOCALFOLDER
3+
known_numpy = numpy
4+
known_pyplot = matplotlib.pyplot
5+
sections=FUTURE,STDLIB,THIRDPARTY,NUMPY,PYPLOT,MPLTOOLKITS,FIRSTPARTY,LOCALFOLDER
6+
no_lines_before = PYPLOT
57
force_sort_within_sections = true

examples/animation/animate_decay.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
import itertools
1515

1616
import numpy as np
17+
import matplotlib.pyplot as plt
1718

1819
import matplotlib.animation as animation
19-
import matplotlib.pyplot as plt
2020

2121

2222
def data_gen():

examples/animation/animated_histogram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"""
99

1010
import numpy as np
11+
import matplotlib.pyplot as plt
1112

1213
import matplotlib.animation as animation
13-
import matplotlib.pyplot as plt
1414

1515
# Fixing random state for reproducibility
1616
np.random.seed(19680801)

examples/animation/animation_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"""
1616

1717
import numpy as np
18-
1918
import matplotlib.pyplot as plt
2019

2120
np.random.seed(19680801)

examples/animation/bayes_update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
import math
1515

1616
import numpy as np
17+
import matplotlib.pyplot as plt
1718

1819
from matplotlib.animation import FuncAnimation
19-
import matplotlib.pyplot as plt
2020

2121

2222
def beta_pdf(x, a, b):

examples/animation/double_pendulum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515

1616
import numpy as np
1717
from numpy import cos, sin
18+
import matplotlib.pyplot as plt
1819

1920
import matplotlib.animation as animation
20-
import matplotlib.pyplot as plt
2121

2222
G = 9.8 # acceleration due to gravity, in m/s^2
2323
L1 = 1.0 # length of pendulum 1 in m

examples/animation/dynamic_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"""
88

99
import numpy as np
10+
import matplotlib.pyplot as plt
1011

1112
import matplotlib.animation as animation
12-
import matplotlib.pyplot as plt
1313

1414
fig, ax = plt.subplots()
1515

examples/animation/frame_grabbing_sgskip.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
import matplotlib
1616

1717
matplotlib.use("Agg")
18-
from matplotlib.animation import FFMpegWriter
1918
import matplotlib.pyplot as plt
2019

20+
from matplotlib.animation import FFMpegWriter
21+
2122
# Fixing random state for reproducibility
2223
np.random.seed(19680801)
2324

examples/animation/multiple_axes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"""
1313

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

1617
import matplotlib.animation as animation
1718
from matplotlib.patches import ConnectionPatch
18-
import matplotlib.pyplot as plt
1919

2020
fig, (axl, axr) = plt.subplots(
2121
ncols=2,

examples/animation/pause_resume.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
"""
2121

2222
import numpy as np
23+
import matplotlib.pyplot as plt
2324

2425
import matplotlib.animation as animation
25-
import matplotlib.pyplot as plt
2626

2727

2828
class PauseAnimation:

examples/animation/rain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
"""
1313

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

1617
from matplotlib.animation import FuncAnimation
17-
import matplotlib.pyplot as plt
1818

1919
# Fixing random state for reproducibility
2020
np.random.seed(19680801)

examples/animation/random_walk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"""
88

99
import numpy as np
10+
import matplotlib.pyplot as plt
1011

1112
import matplotlib.animation as animation
12-
import matplotlib.pyplot as plt
1313

1414
# Fixing random state for reproducibility
1515
np.random.seed(19680801)

examples/animation/simple_anim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"""
88

99
import numpy as np
10+
import matplotlib.pyplot as plt
1011

1112
import matplotlib.animation as animation
12-
import matplotlib.pyplot as plt
1313

1414
fig, ax = plt.subplots()
1515

examples/animation/simple_scatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
Output generate via `matplotlib.animation.Animation.to_jshtml`.
77
"""
88
import numpy as np
9+
import matplotlib.pyplot as plt
910

1011
import matplotlib.animation as animation
11-
import matplotlib.pyplot as plt
1212

1313
fig, ax = plt.subplots()
1414
ax.set_xlim([0, 10])

examples/animation/strip_chart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"""
1010

1111
import numpy as np
12+
import matplotlib.pyplot as plt
1213

1314
import matplotlib.animation as animation
1415
from matplotlib.lines import Line2D
15-
import matplotlib.pyplot as plt
1616

1717

1818
class Scope:

examples/animation/unchained.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
"""
1313

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

1617
import matplotlib.animation as animation
17-
import matplotlib.pyplot as plt
1818

1919
# Fixing random state for reproducibility
2020
np.random.seed(19680801)

examples/axes_grid1/demo_anchored_direction_arrows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
66
"""
77
import numpy as np
8+
import matplotlib.pyplot as plt
89

910
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredDirectionArrows
1011

1112
import matplotlib.font_manager as fm
12-
import matplotlib.pyplot as plt
1313

1414
# Fixing random state for reproducibility
1515
np.random.seed(19680801)

examples/axes_grid1/demo_axes_divider.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
create a divider for them using existing axes instances.
88
"""
99

10-
from matplotlib import cbook
1110
import matplotlib.pyplot as plt
1211

12+
from matplotlib import cbook
13+
1314

1415
def get_demo_image():
1516
z = cbook.get_sample_data("axes_grid/bivariate_normal.npy", np_load=True)

examples/axes_grid1/demo_axes_grid.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
Grid of 2x2 images with a single colorbar or with one colorbar per axes.
77
"""
88

9+
import matplotlib.pyplot as plt
10+
911
from mpl_toolkits.axes_grid1 import ImageGrid
1012

1113
from matplotlib import cbook
12-
import matplotlib.pyplot as plt
1314

1415
Z = cbook.get_sample_data( # (15, 15) array
1516
"axes_grid/bivariate_normal.npy", np_load=True)

examples/axes_grid1/demo_axes_grid2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
"""
88

99
import numpy as np
10+
import matplotlib.pyplot as plt
1011

1112
from mpl_toolkits.axes_grid1 import ImageGrid
1213

1314
from matplotlib import cbook
1415
import matplotlib.colors
15-
import matplotlib.pyplot as plt
1616

1717

1818
def add_inner_title(ax, title, loc, **kwargs):

examples/axes_grid1/demo_axes_hbox_divider.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
"""
1212

1313
import numpy as np
14+
import matplotlib.pyplot as plt
1415

1516
from mpl_toolkits.axes_grid1.axes_divider import HBoxDivider, VBoxDivider
1617
import mpl_toolkits.axes_grid1.axes_size as Size
1718

18-
import matplotlib.pyplot as plt
19-
2019
arr1 = np.arange(20).reshape((4, 5))
2120
arr2 = np.arange(20).reshape((5, 4))
2221

examples/axes_grid1/demo_axes_rgb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
"""
1010

1111
import numpy as np
12+
import matplotlib.pyplot as plt
1213

1314
from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes, make_rgb_axes
1415

1516
from matplotlib import cbook
16-
import matplotlib.pyplot as plt
1717

1818

1919
def get_rgb():

examples/axes_grid1/demo_colorbar_of_inset_axes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
===============================
55
"""
66

7+
import matplotlib.pyplot as plt
8+
79
from mpl_toolkits.axes_grid1.inset_locator import inset_axes, zoomed_inset_axes
810

911
from matplotlib import cbook
10-
import matplotlib.pyplot as plt
1112

1213
fig, ax = plt.subplots(figsize=[5, 4])
1314
ax.set(aspect=1, xlim=(-15, 15), ylim=(-20, 5))

examples/axes_grid1/demo_colorbar_with_axes_divider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
uses `.append_axes` to add colorbars next to axes.
1111
"""
1212

13-
from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable
14-
1513
import matplotlib.pyplot as plt
1614

15+
from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable
16+
1717
fig, (ax1, ax2) = plt.subplots(1, 2)
1818
fig.subplots_adjust(wspace=0.5)
1919

examples/axes_grid1/demo_colorbar_with_inset_locator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
work in the same way, and are also demonstrated here.
1313
"""
1414

15-
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
16-
1715
import matplotlib.pyplot as plt
1816

17+
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
18+
1919
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=[6, 3])
2020

2121
im1 = ax1.imshow([[1, 2], [2, 3]])

examples/axes_grid1/demo_edge_colorbar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
of an image grid.
88
"""
99

10+
import matplotlib.pyplot as plt
11+
1012
from mpl_toolkits.axes_grid1 import AxesGrid
1113

1214
from matplotlib import cbook
13-
import matplotlib.pyplot as plt
1415

1516

1617
def get_demo_image():

examples/axes_grid1/demo_fixed_size_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
===============================
55
"""
66

7-
from mpl_toolkits.axes_grid1 import Divider, Size
8-
97
import matplotlib.pyplot as plt
108

9+
from mpl_toolkits.axes_grid1 import Divider, Size
10+
1111
# %%
1212

1313

examples/axes_grid1/demo_imagegrid_aspect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
=========================================
55
"""
66

7-
from mpl_toolkits.axes_grid1 import ImageGrid
8-
97
import matplotlib.pyplot as plt
108

9+
from mpl_toolkits.axes_grid1 import ImageGrid
10+
1111
fig = plt.figure()
1212

1313
grid1 = ImageGrid(fig, 121, (2, 2), axes_pad=0.1,

examples/axes_grid1/inset_locator_demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
# By default, the inset is offset by some points from the axes,
1414
# controlled via the *borderpad* parameter.
1515

16-
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
17-
1816
import matplotlib.pyplot as plt
1917

18+
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
19+
2020
fig, (ax, ax2) = plt.subplots(1, 2, figsize=[5.5, 2.8])
2121

2222
# Create inset of width 1.3 inches and height 0.9 inches

examples/axes_grid1/inset_locator_demo2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
"""
1414

1515
import numpy as np
16+
import matplotlib.pyplot as plt
1617

1718
from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar
1819
from mpl_toolkits.axes_grid1.inset_locator import mark_inset, zoomed_inset_axes
1920

2021
from matplotlib import cbook
21-
import matplotlib.pyplot as plt
2222

2323

2424
def get_demo_image():

examples/axes_grid1/make_room_for_ylabel_using_axesgrid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
====================================
55
"""
66

7+
import matplotlib.pyplot as plt
8+
79
from mpl_toolkits.axes_grid1 import make_axes_locatable
810
from mpl_toolkits.axes_grid1.axes_divider import make_axes_area_auto_adjustable
911

10-
import matplotlib.pyplot as plt
11-
1212
fig = plt.figure()
1313
ax = fig.add_axes([0, 0, 1, 1])
1414

examples/axes_grid1/parasite_simple.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
===============
55
"""
66

7-
from mpl_toolkits.axes_grid1 import host_subplot
8-
97
import matplotlib.pyplot as plt
108

9+
from mpl_toolkits.axes_grid1 import host_subplot
10+
1111
host = host_subplot(111)
1212
par = host.twinx()
1313

examples/axes_grid1/parasite_simple2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
================
55
66
"""
7+
import matplotlib.pyplot as plt
8+
79
from mpl_toolkits.axes_grid1.parasite_axes import HostAxes
810

9-
import matplotlib.pyplot as plt
1011
import matplotlib.transforms as mtransforms
1112

1213
obs = [["01_S1", 3.88, 0.14, 1970, 63],

0 commit comments

Comments
 (0)