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

Skip to content

Commit 66d2282

Browse files
authored
Merge pull request #11651 from QuLogic/example-imports
Remove unused imports in examples
2 parents cb127ba + bed25a8 commit 66d2282

Some content is hidden

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

57 files changed

+96
-73
lines changed

examples/event_handling/ginput_manual_clabel_sgskip.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414
1515
"""
1616

17-
1817
import time
19-
import matplotlib
18+
2019
import numpy as np
21-
import matplotlib.cm as cm
22-
import matplotlib.mlab as mlab
2320
import matplotlib.pyplot as plt
2421

2522

examples/frontpage/3D.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
This example reproduces the frontpage 3D example.
77
88
"""
9-
from mpl_toolkits.mplot3d import Axes3D
9+
# This import registers the 3D projection, but is otherwise unused.
10+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
11+
1012
from matplotlib import cbook
1113
from matplotlib import cm
1214
from matplotlib.colors import LightSource

examples/images_contours_and_fields/contour_label_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
import matplotlib
1414
import numpy as np
15-
import matplotlib.cm as cm
1615
import matplotlib.ticker as ticker
1716
import matplotlib.pyplot as plt
1817

examples/images_contours_and_fields/figimage_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"""
99
import numpy as np
1010
import matplotlib
11-
import matplotlib.cm as cm
1211
import matplotlib.pyplot as plt
1312

1413

examples/images_contours_and_fields/quadmesh_demo.py

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

1212
import copy
1313

14-
from matplotlib import cm, colors, pyplot as plt
14+
from matplotlib import cm, pyplot as plt
1515
import numpy as np
1616

1717
n = 12

examples/images_contours_and_fields/quiver_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"""
1414
import matplotlib.pyplot as plt
1515
import numpy as np
16-
from numpy import ma
1716

1817
X, Y = np.meshgrid(np.arange(0, 2 * np.pi, .2), np.arange(0, 2 * np.pi, .2))
1918
U = np.cos(X)

examples/lines_bars_and_markers/scatter_symbol.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"""
99
import matplotlib.pyplot as plt
1010
import numpy as np
11-
import matplotlib
1211

1312
# Fixing random state for reproducibility
1413
np.random.seed(19680801)

examples/misc/load_converter.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import numpy as np
88
import matplotlib.pyplot as plt
99
import matplotlib.cbook as cbook
10-
import matplotlib.dates as mdates
1110
from matplotlib.dates import bytespdate2num
1211

1312
datafile = cbook.get_sample_data('msft.csv', asfileobj=False)

examples/misc/plotfile_demo.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
Example use of ``plotfile`` to plot data directly from a file.
77
"""
88
import matplotlib.pyplot as plt
9-
import numpy as np
10-
119
import matplotlib.cbook as cbook
1210

1311
fname = cbook.get_sample_data('msft.csv', asfileobj=False)

examples/misc/transoffset.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import matplotlib.transforms as mtransforms
2424
import numpy as np
2525

26-
from matplotlib.transforms import offset_copy
2726

2827
xs = np.arange(7)
2928
ys = xs**2

examples/mplot3d/2dcollections3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
selective axes of a 3D plot.
88
"""
99

10-
from mpl_toolkits.mplot3d import Axes3D
10+
# This import registers the 3D projection, but is otherwise unused.
11+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
12+
1113
import numpy as np
1214
import matplotlib.pyplot as plt
1315

examples/mplot3d/3d_bars.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
import numpy as np
1212
import matplotlib.pyplot as plt
13-
from mpl_toolkits.mplot3d import Axes3D
13+
# This import registers the 3D projection, but is otherwise unused.
14+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
1415

1516

1617
# setup the figure and axes

examples/mplot3d/bars3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
planes y=0, y=1, etc.
88
"""
99

10-
from mpl_toolkits.mplot3d import Axes3D
10+
# This import registers the 3D projection, but is otherwise unused.
11+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
12+
1113
import matplotlib.pyplot as plt
1214
import numpy as np
1315

examples/mplot3d/custom_shaded_3d_surface.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
Demonstrates using custom hillshading in a 3D surface plot.
77
"""
88

9-
from mpl_toolkits.mplot3d import Axes3D
9+
# This import registers the 3D projection, but is otherwise unused.
10+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
11+
1012
from matplotlib import cbook
1113
from matplotlib import cm
1214
from matplotlib.colors import LightSource

examples/mplot3d/hist3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
Demo of a histogram for 2 dimensional data as a bar graph in 3D.
77
"""
88

9-
from mpl_toolkits.mplot3d import Axes3D
9+
# This import registers the 3D projection, but is otherwise unused.
10+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
11+
1012
import matplotlib.pyplot as plt
1113
import numpy as np
1214

examples/mplot3d/lines3d.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
This example demonstrates plotting a parametric curve in 3D.
77
'''
88

9-
import matplotlib as mpl
10-
from mpl_toolkits.mplot3d import Axes3D
9+
# This import registers the 3D projection, but is otherwise unused.
10+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
11+
1112
import numpy as np
1213
import matplotlib.pyplot as plt
1314

14-
mpl.rcParams['legend.fontsize'] = 10
15+
16+
plt.rcParams['legend.fontsize'] = 10
1517

1618
fig = plt.figure()
1719
ax = fig.gca(projection='3d')

examples/mplot3d/lorenz_attractor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515

1616
import numpy as np
1717
import matplotlib.pyplot as plt
18-
from mpl_toolkits.mplot3d import Axes3D
18+
# This import registers the 3D projection, but is otherwise unused.
19+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
1920

2021

2122
def lorenz(x, y, z, s=10, r=28, b=2.667):

examples/mplot3d/mixed_subplots.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
66
This example shows a how to plot a 2D and 3D plot on the same figure.
77
"""
8-
from mpl_toolkits.mplot3d import Axes3D
8+
# This import registers the 3D projection, but is otherwise unused.
9+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
10+
911
import matplotlib.pyplot as plt
1012
import numpy as np
1113

examples/mplot3d/offset.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
automatically trigger it.
1414
'''
1515

16-
from mpl_toolkits.mplot3d import Axes3D
16+
# This import registers the 3D projection, but is otherwise unused.
17+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
18+
1719
import matplotlib.pyplot as plt
1820
import numpy as np
1921

examples/mplot3d/pathpatch3d.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
import numpy as np
1010
import matplotlib.pyplot as plt
1111
from matplotlib.patches import Circle, PathPatch
12-
# register Axes3D class with matplotlib by importing Axes3D
13-
from mpl_toolkits.mplot3d import Axes3D
14-
import mpl_toolkits.mplot3d.art3d as art3d
1512
from matplotlib.text import TextPath
1613
from matplotlib.transforms import Affine2D
14+
# This import registers the 3D projection, but is otherwise unused.
15+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
16+
import mpl_toolkits.mplot3d.art3d as art3d
1717

1818

1919
def text3d(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs):

examples/mplot3d/polys3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
of 'jagged stained glass' effect.
99
"""
1010

11-
from mpl_toolkits.mplot3d import Axes3D
11+
# This import registers the 3D projection, but is otherwise unused.
12+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
13+
1214
from matplotlib.collections import PolyCollection
1315
import matplotlib.pyplot as plt
1416
from matplotlib import colors as mcolors

examples/mplot3d/quiver3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
Demonstrates plotting directional arrows at points on a 3d meshgrid.
77
'''
88

9-
from mpl_toolkits.mplot3d import axes3d
9+
# This import registers the 3D projection, but is otherwise unused.
10+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
11+
1012
import matplotlib.pyplot as plt
1113
import numpy as np
1214

examples/mplot3d/scatter3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
Demonstration of a basic scatterplot in 3D.
77
'''
88

9-
from mpl_toolkits.mplot3d import Axes3D
9+
# This import registers the 3D projection, but is otherwise unused.
10+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
11+
1012
import matplotlib.pyplot as plt
1113
import numpy as np
1214

examples/mplot3d/subplot3d.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
'''
88

99
import matplotlib.pyplot as plt
10-
from mpl_toolkits.mplot3d.axes3d import Axes3D, get_test_data
1110
from matplotlib import cm
1211
import numpy as np
1312

13+
from mpl_toolkits.mplot3d.axes3d import get_test_data
14+
# This import registers the 3D projection, but is otherwise unused.
15+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
16+
1417

1518
# set up a figure twice as wide as it is tall
1619
fig = plt.figure(figsize=plt.figaspect(0.5))

examples/mplot3d/surface3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
z axis tick labels.
1111
'''
1212

13-
from mpl_toolkits.mplot3d import Axes3D
13+
# This import registers the 3D projection, but is otherwise unused.
14+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
15+
1416
import matplotlib.pyplot as plt
1517
from matplotlib import cm
1618
from matplotlib.ticker import LinearLocator, FormatStrFormatter

examples/mplot3d/surface3d_2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
Demonstrates a very basic plot of a 3D surface using a solid color.
77
'''
88

9-
from mpl_toolkits.mplot3d import Axes3D
9+
# This import registers the 3D projection, but is otherwise unused.
10+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
11+
1012
import matplotlib.pyplot as plt
1113
import numpy as np
1214

examples/mplot3d/surface3d_3.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
Demonstrates plotting a 3D surface colored in a checkerboard pattern.
77
'''
88

9-
from mpl_toolkits.mplot3d import Axes3D
9+
# This import registers the 3D projection, but is otherwise unused.
10+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
11+
1012
import matplotlib.pyplot as plt
11-
from matplotlib import cm
1213
from matplotlib.ticker import LinearLocator
1314
import numpy as np
1415

examples/mplot3d/surface3d_radial.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
Example contributed by Armin Moser.
1111
'''
1212

13-
from mpl_toolkits.mplot3d import Axes3D
13+
# This import registers the 3D projection, but is otherwise unused.
14+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
15+
1416
import matplotlib.pyplot as plt
1517
import numpy as np
1618

examples/mplot3d/text3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
1717
'''
1818

19-
from mpl_toolkits.mplot3d import Axes3D
19+
# This import registers the 3D projection, but is otherwise unused.
20+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
21+
2022
import matplotlib.pyplot as plt
2123

2224

examples/mplot3d/tricontour3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
tricontourf3d_demo shows the filled version of this example.
1010
"""
1111

12+
# This import registers the 3D projection, but is otherwise unused.
13+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
14+
1215
import matplotlib.pyplot as plt
13-
from mpl_toolkits.mplot3d import Axes3D
1416
import matplotlib.tri as tri
1517
import numpy as np
1618

examples/mplot3d/tricontourf3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
tricontour3d_demo shows the unfilled version of this example.
1010
"""
1111

12+
# This import registers the 3D projection, but is otherwise unused.
13+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
14+
1215
import matplotlib.pyplot as plt
13-
from mpl_toolkits.mplot3d import Axes3D
1416
import matplotlib.tri as tri
1517
import numpy as np
1618

examples/mplot3d/trisurf3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
Plot a 3D surface with a triangular mesh.
77
'''
88

9-
from mpl_toolkits.mplot3d import Axes3D
9+
# This import registers the 3D projection, but is otherwise unused.
10+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
11+
1012
import matplotlib.pyplot as plt
1113
import numpy as np
1214

examples/mplot3d/trisurf3d_2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212

1313
import numpy as np
1414
import matplotlib.pyplot as plt
15-
from mpl_toolkits.mplot3d import Axes3D
1615
import matplotlib.tri as mtri
1716

17+
# This import registers the 3D projection, but is otherwise unused.
18+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
19+
1820

1921
fig = plt.figure(figsize=plt.figaspect(0.5))
2022

examples/mplot3d/voxels.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88

99
import matplotlib.pyplot as plt
1010
import numpy as np
11-
from mpl_toolkits.mplot3d import Axes3D
11+
12+
# This import registers the 3D projection, but is otherwise unused.
13+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
14+
1215

1316
# prepare some coordinates
1417
x, y, z = np.indices((8, 8, 8))

examples/mplot3d/voxels_numpy_logo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
'''
88
import matplotlib.pyplot as plt
99
import numpy as np
10-
from mpl_toolkits.mplot3d import Axes3D
10+
11+
# This import registers the 3D projection, but is otherwise unused.
12+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
1113

1214

1315
def explode(data):

examples/mplot3d/voxels_rgb.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88

99
import matplotlib.pyplot as plt
1010
import numpy as np
11-
from mpl_toolkits.mplot3d import Axes3D
11+
12+
# This import registers the 3D projection, but is otherwise unused.
13+
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
1214

1315

1416
def midpoints(x):

0 commit comments

Comments
 (0)