From f04a33ae1a2b0518dcbc66d199b0cce1fda9446d Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 10 Jul 2018 15:24:19 -0400 Subject: [PATCH 1/2] Remove unused imports from examples. --- examples/event_handling/ginput_manual_clabel_sgskip.py | 5 +---- examples/images_contours_and_fields/contour_label_demo.py | 1 - examples/images_contours_and_fields/figimage_demo.py | 1 - examples/images_contours_and_fields/quadmesh_demo.py | 2 +- examples/images_contours_and_fields/quiver_demo.py | 1 - examples/lines_bars_and_markers/scatter_symbol.py | 1 - examples/misc/load_converter.py | 1 - examples/misc/plotfile_demo.py | 2 -- examples/misc/transoffset.py | 1 - examples/mplot3d/surface3d_3.py | 1 - examples/pyplots/fig_axes_customize_simple.py | 2 +- examples/pyplots/fig_x.py | 1 - examples/shapes_and_collections/patch_collection.py | 1 - examples/specialty_plots/sankey_basics.py | 2 +- examples/specialty_plots/sankey_links.py | 2 -- examples/statistics/violinplot.py | 1 - examples/subplots_axes_and_figures/figure_title.py | 1 - examples/tests/backend_driver_sgskip.py | 1 - examples/text_labels_and_annotations/date.py | 1 - examples/text_labels_and_annotations/fonts_demo_kw.py | 2 -- examples/text_labels_and_annotations/mathtext_examples.py | 1 - examples/text_labels_and_annotations/text_alignment.py | 2 -- examples/text_labels_and_annotations/usetex_baseline_test.py | 1 - examples/units/basic_units.py | 1 - examples/user_interfaces/embedding_in_wx3_sgskip.py | 5 ----- examples/user_interfaces/mpl_with_glade3_sgskip.py | 1 - examples/userdemo/connectionstyle_demo.py | 1 - examples/widgets/menu.py | 1 - 28 files changed, 4 insertions(+), 39 deletions(-) diff --git a/examples/event_handling/ginput_manual_clabel_sgskip.py b/examples/event_handling/ginput_manual_clabel_sgskip.py index abe1e345d86b..96104cace49d 100644 --- a/examples/event_handling/ginput_manual_clabel_sgskip.py +++ b/examples/event_handling/ginput_manual_clabel_sgskip.py @@ -14,12 +14,9 @@ """ - import time -import matplotlib + import numpy as np -import matplotlib.cm as cm -import matplotlib.mlab as mlab import matplotlib.pyplot as plt diff --git a/examples/images_contours_and_fields/contour_label_demo.py b/examples/images_contours_and_fields/contour_label_demo.py index af26ab997c87..f09a7f6a141d 100644 --- a/examples/images_contours_and_fields/contour_label_demo.py +++ b/examples/images_contours_and_fields/contour_label_demo.py @@ -12,7 +12,6 @@ import matplotlib import numpy as np -import matplotlib.cm as cm import matplotlib.ticker as ticker import matplotlib.pyplot as plt diff --git a/examples/images_contours_and_fields/figimage_demo.py b/examples/images_contours_and_fields/figimage_demo.py index b2ce013d77a5..ef805576cae0 100644 --- a/examples/images_contours_and_fields/figimage_demo.py +++ b/examples/images_contours_and_fields/figimage_demo.py @@ -8,7 +8,6 @@ """ import numpy as np import matplotlib -import matplotlib.cm as cm import matplotlib.pyplot as plt diff --git a/examples/images_contours_and_fields/quadmesh_demo.py b/examples/images_contours_and_fields/quadmesh_demo.py index 0e517a886a10..5488ddd83637 100644 --- a/examples/images_contours_and_fields/quadmesh_demo.py +++ b/examples/images_contours_and_fields/quadmesh_demo.py @@ -11,7 +11,7 @@ import copy -from matplotlib import cm, colors, pyplot as plt +from matplotlib import cm, pyplot as plt import numpy as np n = 12 diff --git a/examples/images_contours_and_fields/quiver_demo.py b/examples/images_contours_and_fields/quiver_demo.py index 7c1711710076..696b0a50ad7e 100644 --- a/examples/images_contours_and_fields/quiver_demo.py +++ b/examples/images_contours_and_fields/quiver_demo.py @@ -13,7 +13,6 @@ """ import matplotlib.pyplot as plt import numpy as np -from numpy import ma X, Y = np.meshgrid(np.arange(0, 2 * np.pi, .2), np.arange(0, 2 * np.pi, .2)) U = np.cos(X) diff --git a/examples/lines_bars_and_markers/scatter_symbol.py b/examples/lines_bars_and_markers/scatter_symbol.py index 3d04490c189e..d99b6a80a740 100644 --- a/examples/lines_bars_and_markers/scatter_symbol.py +++ b/examples/lines_bars_and_markers/scatter_symbol.py @@ -8,7 +8,6 @@ """ import matplotlib.pyplot as plt import numpy as np -import matplotlib # Fixing random state for reproducibility np.random.seed(19680801) diff --git a/examples/misc/load_converter.py b/examples/misc/load_converter.py index 33a482cb27b7..9488972cae87 100644 --- a/examples/misc/load_converter.py +++ b/examples/misc/load_converter.py @@ -7,7 +7,6 @@ import numpy as np import matplotlib.pyplot as plt import matplotlib.cbook as cbook -import matplotlib.dates as mdates from matplotlib.dates import bytespdate2num datafile = cbook.get_sample_data('msft.csv', asfileobj=False) diff --git a/examples/misc/plotfile_demo.py b/examples/misc/plotfile_demo.py index b927b4870add..94bd1bd9b2bb 100644 --- a/examples/misc/plotfile_demo.py +++ b/examples/misc/plotfile_demo.py @@ -6,8 +6,6 @@ Example use of ``plotfile`` to plot data directly from a file. """ import matplotlib.pyplot as plt -import numpy as np - import matplotlib.cbook as cbook fname = cbook.get_sample_data('msft.csv', asfileobj=False) diff --git a/examples/misc/transoffset.py b/examples/misc/transoffset.py index 127ca6bf6769..7328ce2103f3 100644 --- a/examples/misc/transoffset.py +++ b/examples/misc/transoffset.py @@ -23,7 +23,6 @@ import matplotlib.transforms as mtransforms import numpy as np -from matplotlib.transforms import offset_copy xs = np.arange(7) ys = xs**2 diff --git a/examples/mplot3d/surface3d_3.py b/examples/mplot3d/surface3d_3.py index 06ab93ab0a2c..bef4e41acf43 100644 --- a/examples/mplot3d/surface3d_3.py +++ b/examples/mplot3d/surface3d_3.py @@ -8,7 +8,6 @@ from mpl_toolkits.mplot3d import Axes3D import matplotlib.pyplot as plt -from matplotlib import cm from matplotlib.ticker import LinearLocator import numpy as np diff --git a/examples/pyplots/fig_axes_customize_simple.py b/examples/pyplots/fig_axes_customize_simple.py index 50c2411bfcb8..47d8eafbc647 100644 --- a/examples/pyplots/fig_axes_customize_simple.py +++ b/examples/pyplots/fig_axes_customize_simple.py @@ -5,7 +5,7 @@ Customize the background, labels and ticks of a simple plot. """ -import numpy as np + import matplotlib.pyplot as plt ############################################################################### diff --git a/examples/pyplots/fig_x.py b/examples/pyplots/fig_x.py index 4e5d120a9a9b..d8a8c1dfaa3d 100644 --- a/examples/pyplots/fig_x.py +++ b/examples/pyplots/fig_x.py @@ -5,7 +5,6 @@ Add lines to a figure (without axes). """ -import numpy as np import matplotlib.pyplot as plt import matplotlib.lines as lines diff --git a/examples/shapes_and_collections/patch_collection.py b/examples/shapes_and_collections/patch_collection.py index f86d59ea65b2..05e343465ffe 100644 --- a/examples/shapes_and_collections/patch_collection.py +++ b/examples/shapes_and_collections/patch_collection.py @@ -8,7 +8,6 @@ """ import numpy as np -import matplotlib from matplotlib.patches import Circle, Wedge, Polygon from matplotlib.collections import PatchCollection import matplotlib.pyplot as plt diff --git a/examples/specialty_plots/sankey_basics.py b/examples/specialty_plots/sankey_basics.py index abfd913e193b..f625a59a8c45 100644 --- a/examples/specialty_plots/sankey_basics.py +++ b/examples/specialty_plots/sankey_basics.py @@ -5,7 +5,7 @@ Demonstrate the Sankey class by producing three basic diagrams. """ -import numpy as np + import matplotlib.pyplot as plt from matplotlib.sankey import Sankey diff --git a/examples/specialty_plots/sankey_links.py b/examples/specialty_plots/sankey_links.py index 7221d3592058..61dfc06d41b0 100644 --- a/examples/specialty_plots/sankey_links.py +++ b/examples/specialty_plots/sankey_links.py @@ -6,8 +6,6 @@ Demonstrate/test the Sankey class by producing a long chain of connections. """ -from itertools import cycle - import matplotlib.pyplot as plt from matplotlib.sankey import Sankey diff --git a/examples/statistics/violinplot.py b/examples/statistics/violinplot.py index 03640bc56272..667f23e2a308 100644 --- a/examples/statistics/violinplot.py +++ b/examples/statistics/violinplot.py @@ -16,7 +16,6 @@ have a great section: http://scikit-learn.org/stable/modules/density.html """ -import random import numpy as np import matplotlib.pyplot as plt diff --git a/examples/subplots_axes_and_figures/figure_title.py b/examples/subplots_axes_and_figures/figure_title.py index cb96d5bacde9..1c54c3887be7 100644 --- a/examples/subplots_axes_and_figures/figure_title.py +++ b/examples/subplots_axes_and_figures/figure_title.py @@ -5,7 +5,6 @@ Create a figure with separate subplot titles and a centered figure title. """ -from matplotlib.font_manager import FontProperties import matplotlib.pyplot as plt import numpy as np diff --git a/examples/tests/backend_driver_sgskip.py b/examples/tests/backend_driver_sgskip.py index acbd99ab6ed2..8878c6273bce 100644 --- a/examples/tests/backend_driver_sgskip.py +++ b/examples/tests/backend_driver_sgskip.py @@ -357,7 +357,6 @@ def drive(backend, directories, python=['python'], switches=[]): # Clear the destination directory for the examples path = backend if os.path.exists(path): - import glob for fname in os.listdir(path): os.unlink(os.path.join(path, fname)) else: diff --git a/examples/text_labels_and_annotations/date.py b/examples/text_labels_and_annotations/date.py index 383db6353e13..90e9f94a511e 100644 --- a/examples/text_labels_and_annotations/date.py +++ b/examples/text_labels_and_annotations/date.py @@ -16,7 +16,6 @@ :class:`numpy.datetime64` objects. """ -import datetime import numpy as np import matplotlib.pyplot as plt import matplotlib.dates as mdates diff --git a/examples/text_labels_and_annotations/fonts_demo_kw.py b/examples/text_labels_and_annotations/fonts_demo_kw.py index f323570cada5..bfcec95f93f2 100644 --- a/examples/text_labels_and_annotations/fonts_demo_kw.py +++ b/examples/text_labels_and_annotations/fonts_demo_kw.py @@ -8,9 +8,7 @@ See :doc:`fonts_demo` to achieve the same effect using setters. """ -from matplotlib.font_manager import FontProperties import matplotlib.pyplot as plt -import numpy as np plt.subplot(111, facecolor='w') alignment = {'horizontalalignment': 'center', 'verticalalignment': 'baseline'} diff --git a/examples/text_labels_and_annotations/mathtext_examples.py b/examples/text_labels_and_annotations/mathtext_examples.py index eec403d3c531..6272099819f5 100644 --- a/examples/text_labels_and_annotations/mathtext_examples.py +++ b/examples/text_labels_and_annotations/mathtext_examples.py @@ -9,7 +9,6 @@ import subprocess import sys import re -import gc # Selection of features following "Writing mathematical expressions" tutorial mathtext_titles = { diff --git a/examples/text_labels_and_annotations/text_alignment.py b/examples/text_labels_and_annotations/text_alignment.py index 2503440c3277..e92984098c92 100644 --- a/examples/text_labels_and_annotations/text_alignment.py +++ b/examples/text_labels_and_annotations/text_alignment.py @@ -9,8 +9,6 @@ """ import matplotlib.pyplot as plt -from matplotlib.lines import Line2D -from matplotlib.patches import Rectangle # Build a rectangle in axes coords left, width = .25, .5 diff --git a/examples/text_labels_and_annotations/usetex_baseline_test.py b/examples/text_labels_and_annotations/usetex_baseline_test.py index 0a72afab63e2..3aa08103bbb5 100644 --- a/examples/text_labels_and_annotations/usetex_baseline_test.py +++ b/examples/text_labels_and_annotations/usetex_baseline_test.py @@ -5,7 +5,6 @@ """ -import matplotlib import matplotlib.pyplot as plt import matplotlib.axes as maxes diff --git a/examples/units/basic_units.py b/examples/units/basic_units.py index 826f543e9c3d..67ffa36f6fac 100644 --- a/examples/units/basic_units.py +++ b/examples/units/basic_units.py @@ -11,7 +11,6 @@ import matplotlib.units as units import matplotlib.ticker as ticker -from matplotlib.axes import Axes from matplotlib.cbook import iterable diff --git a/examples/user_interfaces/embedding_in_wx3_sgskip.py b/examples/user_interfaces/embedding_in_wx3_sgskip.py index 5a3d1a7aac85..fcb69f0a910b 100644 --- a/examples/user_interfaces/embedding_in_wx3_sgskip.py +++ b/examples/user_interfaces/embedding_in_wx3_sgskip.py @@ -21,11 +21,6 @@ Thanks to matplotlib and wx teams for creating such great software! """ - -import sys -import time -import os -import gc import matplotlib import matplotlib.cm as cm import matplotlib.cbook as cbook diff --git a/examples/user_interfaces/mpl_with_glade3_sgskip.py b/examples/user_interfaces/mpl_with_glade3_sgskip.py index ffdf22e32ce0..3329bc342da9 100644 --- a/examples/user_interfaces/mpl_with_glade3_sgskip.py +++ b/examples/user_interfaces/mpl_with_glade3_sgskip.py @@ -12,7 +12,6 @@ from gi.repository import Gtk from matplotlib.figure import Figure -from matplotlib.axes import Subplot from matplotlib.backends.backend_gtk3agg import ( FigureCanvasGTK3Agg as FigureCanvas) import numpy as np diff --git a/examples/userdemo/connectionstyle_demo.py b/examples/userdemo/connectionstyle_demo.py index 4c8abe22e4a5..1ea2bf5fe8fd 100644 --- a/examples/userdemo/connectionstyle_demo.py +++ b/examples/userdemo/connectionstyle_demo.py @@ -6,7 +6,6 @@ """ import matplotlib.pyplot as plt -import matplotlib.patches as mpatches fig, axs = plt.subplots(3, 5, figsize=(8, 4.8)) diff --git a/examples/widgets/menu.py b/examples/widgets/menu.py index a099b1fc92ff..fa5e3a54ace0 100644 --- a/examples/widgets/menu.py +++ b/examples/widgets/menu.py @@ -5,7 +5,6 @@ """ import numpy as np -import matplotlib import matplotlib.colors as colors import matplotlib.patches as patches import matplotlib.mathtext as mathtext From bed25a85abca08031f642a844a85c7ca3d7b39df Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 13 Jul 2018 01:08:13 -0400 Subject: [PATCH 2/2] Annotate reason for Axes3D import in examples. --- examples/frontpage/3D.py | 4 +++- examples/mplot3d/2dcollections3d.py | 4 +++- examples/mplot3d/3d_bars.py | 3 ++- examples/mplot3d/bars3d.py | 4 +++- examples/mplot3d/custom_shaded_3d_surface.py | 4 +++- examples/mplot3d/hist3d.py | 4 +++- examples/mplot3d/lines3d.py | 8 +++++--- examples/mplot3d/lorenz_attractor.py | 3 ++- examples/mplot3d/mixed_subplots.py | 4 +++- examples/mplot3d/offset.py | 4 +++- examples/mplot3d/pathpatch3d.py | 6 +++--- examples/mplot3d/polys3d.py | 4 +++- examples/mplot3d/quiver3d.py | 4 +++- examples/mplot3d/scatter3d.py | 4 +++- examples/mplot3d/subplot3d.py | 5 ++++- examples/mplot3d/surface3d.py | 4 +++- examples/mplot3d/surface3d_2.py | 4 +++- examples/mplot3d/surface3d_3.py | 4 +++- examples/mplot3d/surface3d_radial.py | 4 +++- examples/mplot3d/text3d.py | 4 +++- examples/mplot3d/tricontour3d.py | 4 +++- examples/mplot3d/tricontourf3d.py | 4 +++- examples/mplot3d/trisurf3d.py | 4 +++- examples/mplot3d/trisurf3d_2.py | 4 +++- examples/mplot3d/voxels.py | 5 ++++- examples/mplot3d/voxels_numpy_logo.py | 4 +++- examples/mplot3d/voxels_rgb.py | 4 +++- examples/mplot3d/voxels_torus.py | 4 +++- examples/mplot3d/wire3d_animation_sgskip.py | 4 +++- examples/pyplots/whats_new_1_subplot3d.py | 4 +++- 30 files changed, 92 insertions(+), 34 deletions(-) diff --git a/examples/frontpage/3D.py b/examples/frontpage/3D.py index d08b52f54b24..ee93026ed06e 100644 --- a/examples/frontpage/3D.py +++ b/examples/frontpage/3D.py @@ -6,7 +6,9 @@ This example reproduces the frontpage 3D example. """ -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + from matplotlib import cbook from matplotlib import cm from matplotlib.colors import LightSource diff --git a/examples/mplot3d/2dcollections3d.py b/examples/mplot3d/2dcollections3d.py index 21a7a4148749..589e1083f7f5 100644 --- a/examples/mplot3d/2dcollections3d.py +++ b/examples/mplot3d/2dcollections3d.py @@ -7,7 +7,9 @@ selective axes of a 3D plot. """ -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import numpy as np import matplotlib.pyplot as plt diff --git a/examples/mplot3d/3d_bars.py b/examples/mplot3d/3d_bars.py index abacacc85dce..483dbcc4fb71 100644 --- a/examples/mplot3d/3d_bars.py +++ b/examples/mplot3d/3d_bars.py @@ -10,7 +10,8 @@ import numpy as np import matplotlib.pyplot as plt -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import # setup the figure and axes diff --git a/examples/mplot3d/bars3d.py b/examples/mplot3d/bars3d.py index 2cb2a5078b35..e30175ffac41 100644 --- a/examples/mplot3d/bars3d.py +++ b/examples/mplot3d/bars3d.py @@ -7,7 +7,9 @@ planes y=0, y=1, etc. """ -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/mplot3d/custom_shaded_3d_surface.py b/examples/mplot3d/custom_shaded_3d_surface.py index 2c37bfae0fc9..366658856470 100644 --- a/examples/mplot3d/custom_shaded_3d_surface.py +++ b/examples/mplot3d/custom_shaded_3d_surface.py @@ -6,7 +6,9 @@ Demonstrates using custom hillshading in a 3D surface plot. """ -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + from matplotlib import cbook from matplotlib import cm from matplotlib.colors import LightSource diff --git a/examples/mplot3d/hist3d.py b/examples/mplot3d/hist3d.py index 9897f1606c5b..4cab341a64a2 100644 --- a/examples/mplot3d/hist3d.py +++ b/examples/mplot3d/hist3d.py @@ -6,7 +6,9 @@ Demo of a histogram for 2 dimensional data as a bar graph in 3D. """ -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/mplot3d/lines3d.py b/examples/mplot3d/lines3d.py index 34ef9328c663..e0e45b1c051c 100644 --- a/examples/mplot3d/lines3d.py +++ b/examples/mplot3d/lines3d.py @@ -6,12 +6,14 @@ This example demonstrates plotting a parametric curve in 3D. ''' -import matplotlib as mpl -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import numpy as np import matplotlib.pyplot as plt -mpl.rcParams['legend.fontsize'] = 10 + +plt.rcParams['legend.fontsize'] = 10 fig = plt.figure() ax = fig.gca(projection='3d') diff --git a/examples/mplot3d/lorenz_attractor.py b/examples/mplot3d/lorenz_attractor.py index 47b21292b4cb..5a1328a769d3 100644 --- a/examples/mplot3d/lorenz_attractor.py +++ b/examples/mplot3d/lorenz_attractor.py @@ -15,7 +15,8 @@ import numpy as np import matplotlib.pyplot as plt -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import def lorenz(x, y, z, s=10, r=28, b=2.667): diff --git a/examples/mplot3d/mixed_subplots.py b/examples/mplot3d/mixed_subplots.py index fd1af313b6e3..0a13715aad1b 100644 --- a/examples/mplot3d/mixed_subplots.py +++ b/examples/mplot3d/mixed_subplots.py @@ -5,7 +5,9 @@ This example shows a how to plot a 2D and 3D plot on the same figure. """ -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/mplot3d/offset.py b/examples/mplot3d/offset.py index da846c8cc26a..04c56ed2066e 100644 --- a/examples/mplot3d/offset.py +++ b/examples/mplot3d/offset.py @@ -13,7 +13,9 @@ automatically trigger it. ''' -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/mplot3d/pathpatch3d.py b/examples/mplot3d/pathpatch3d.py index 55d33dc94823..5976adf728a5 100644 --- a/examples/mplot3d/pathpatch3d.py +++ b/examples/mplot3d/pathpatch3d.py @@ -9,11 +9,11 @@ import numpy as np import matplotlib.pyplot as plt from matplotlib.patches import Circle, PathPatch -# register Axes3D class with matplotlib by importing Axes3D -from mpl_toolkits.mplot3d import Axes3D -import mpl_toolkits.mplot3d.art3d as art3d from matplotlib.text import TextPath from matplotlib.transforms import Affine2D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import +import mpl_toolkits.mplot3d.art3d as art3d def text3d(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs): diff --git a/examples/mplot3d/polys3d.py b/examples/mplot3d/polys3d.py index 09adab3db8ba..2f7769bb784c 100644 --- a/examples/mplot3d/polys3d.py +++ b/examples/mplot3d/polys3d.py @@ -8,7 +8,9 @@ of 'jagged stained glass' effect. """ -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + from matplotlib.collections import PolyCollection import matplotlib.pyplot as plt from matplotlib import colors as mcolors diff --git a/examples/mplot3d/quiver3d.py b/examples/mplot3d/quiver3d.py index 16ba7eab0190..6921b4a1d26c 100644 --- a/examples/mplot3d/quiver3d.py +++ b/examples/mplot3d/quiver3d.py @@ -6,7 +6,9 @@ Demonstrates plotting directional arrows at points on a 3d meshgrid. ''' -from mpl_toolkits.mplot3d import axes3d +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/mplot3d/scatter3d.py b/examples/mplot3d/scatter3d.py index 090ace56e1ed..d8c6a05606cd 100644 --- a/examples/mplot3d/scatter3d.py +++ b/examples/mplot3d/scatter3d.py @@ -6,7 +6,9 @@ Demonstration of a basic scatterplot in 3D. ''' -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/mplot3d/subplot3d.py b/examples/mplot3d/subplot3d.py index 9ece9f7ddc02..e9c1c3f2d712 100644 --- a/examples/mplot3d/subplot3d.py +++ b/examples/mplot3d/subplot3d.py @@ -7,10 +7,13 @@ ''' import matplotlib.pyplot as plt -from mpl_toolkits.mplot3d.axes3d import Axes3D, get_test_data from matplotlib import cm import numpy as np +from mpl_toolkits.mplot3d.axes3d import get_test_data +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + # set up a figure twice as wide as it is tall fig = plt.figure(figsize=plt.figaspect(0.5)) diff --git a/examples/mplot3d/surface3d.py b/examples/mplot3d/surface3d.py index 44133c271c02..eac122b6aa13 100644 --- a/examples/mplot3d/surface3d.py +++ b/examples/mplot3d/surface3d.py @@ -10,7 +10,9 @@ z axis tick labels. ''' -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter diff --git a/examples/mplot3d/surface3d_2.py b/examples/mplot3d/surface3d_2.py index bfc60ae563ac..fe3c2fe476ea 100644 --- a/examples/mplot3d/surface3d_2.py +++ b/examples/mplot3d/surface3d_2.py @@ -6,7 +6,9 @@ Demonstrates a very basic plot of a 3D surface using a solid color. ''' -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/mplot3d/surface3d_3.py b/examples/mplot3d/surface3d_3.py index bef4e41acf43..d75dc6680152 100644 --- a/examples/mplot3d/surface3d_3.py +++ b/examples/mplot3d/surface3d_3.py @@ -6,7 +6,9 @@ Demonstrates plotting a 3D surface colored in a checkerboard pattern. ''' -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt from matplotlib.ticker import LinearLocator import numpy as np diff --git a/examples/mplot3d/surface3d_radial.py b/examples/mplot3d/surface3d_radial.py index 9125624eca45..521f6195330d 100644 --- a/examples/mplot3d/surface3d_radial.py +++ b/examples/mplot3d/surface3d_radial.py @@ -10,7 +10,9 @@ Example contributed by Armin Moser. ''' -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/mplot3d/text3d.py b/examples/mplot3d/text3d.py index d26cf2b74eaf..ed4934faf5a1 100644 --- a/examples/mplot3d/text3d.py +++ b/examples/mplot3d/text3d.py @@ -16,7 +16,9 @@ ''' -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt diff --git a/examples/mplot3d/tricontour3d.py b/examples/mplot3d/tricontour3d.py index 7e9e6971bb62..feb187cbaa16 100644 --- a/examples/mplot3d/tricontour3d.py +++ b/examples/mplot3d/tricontour3d.py @@ -9,8 +9,10 @@ tricontourf3d_demo shows the filled version of this example. """ +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt -from mpl_toolkits.mplot3d import Axes3D import matplotlib.tri as tri import numpy as np diff --git a/examples/mplot3d/tricontourf3d.py b/examples/mplot3d/tricontourf3d.py index eebb3ef62e6a..d25b2dbd1ea5 100644 --- a/examples/mplot3d/tricontourf3d.py +++ b/examples/mplot3d/tricontourf3d.py @@ -9,8 +9,10 @@ tricontour3d_demo shows the unfilled version of this example. """ +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt -from mpl_toolkits.mplot3d import Axes3D import matplotlib.tri as tri import numpy as np diff --git a/examples/mplot3d/trisurf3d.py b/examples/mplot3d/trisurf3d.py index 4d6283cad211..070a3154f2cb 100644 --- a/examples/mplot3d/trisurf3d.py +++ b/examples/mplot3d/trisurf3d.py @@ -6,7 +6,9 @@ Plot a 3D surface with a triangular mesh. ''' -from mpl_toolkits.mplot3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt import numpy as np diff --git a/examples/mplot3d/trisurf3d_2.py b/examples/mplot3d/trisurf3d_2.py index 24d19e60b498..b948c1b14b5d 100644 --- a/examples/mplot3d/trisurf3d_2.py +++ b/examples/mplot3d/trisurf3d_2.py @@ -12,9 +12,11 @@ import numpy as np import matplotlib.pyplot as plt -from mpl_toolkits.mplot3d import Axes3D import matplotlib.tri as mtri +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + fig = plt.figure(figsize=plt.figaspect(0.5)) diff --git a/examples/mplot3d/voxels.py b/examples/mplot3d/voxels.py index 76cf64c33a00..4ba96fff6c65 100644 --- a/examples/mplot3d/voxels.py +++ b/examples/mplot3d/voxels.py @@ -8,7 +8,10 @@ import matplotlib.pyplot as plt import numpy as np -from mpl_toolkits.mplot3d import Axes3D + +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + # prepare some coordinates x, y, z = np.indices((8, 8, 8)) diff --git a/examples/mplot3d/voxels_numpy_logo.py b/examples/mplot3d/voxels_numpy_logo.py index 648a3cff7822..38b00b49f4de 100644 --- a/examples/mplot3d/voxels_numpy_logo.py +++ b/examples/mplot3d/voxels_numpy_logo.py @@ -7,7 +7,9 @@ ''' import matplotlib.pyplot as plt import numpy as np -from mpl_toolkits.mplot3d import Axes3D + +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import def explode(data): diff --git a/examples/mplot3d/voxels_rgb.py b/examples/mplot3d/voxels_rgb.py index 1b577cad47fe..7b012b2a61f8 100644 --- a/examples/mplot3d/voxels_rgb.py +++ b/examples/mplot3d/voxels_rgb.py @@ -8,7 +8,9 @@ import matplotlib.pyplot as plt import numpy as np -from mpl_toolkits.mplot3d import Axes3D + +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import def midpoints(x): diff --git a/examples/mplot3d/voxels_torus.py b/examples/mplot3d/voxels_torus.py index 4f60e31403d8..3112f82792da 100644 --- a/examples/mplot3d/voxels_torus.py +++ b/examples/mplot3d/voxels_torus.py @@ -9,7 +9,9 @@ import matplotlib.pyplot as plt import matplotlib.colors import numpy as np -from mpl_toolkits.mplot3d import Axes3D + +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import def midpoints(x): diff --git a/examples/mplot3d/wire3d_animation_sgskip.py b/examples/mplot3d/wire3d_animation_sgskip.py index 303a2817a0df..4e727817264c 100644 --- a/examples/mplot3d/wire3d_animation_sgskip.py +++ b/examples/mplot3d/wire3d_animation_sgskip.py @@ -10,7 +10,9 @@ """ -from mpl_toolkits.mplot3d import axes3d +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + import matplotlib.pyplot as plt import numpy as np import time diff --git a/examples/pyplots/whats_new_1_subplot3d.py b/examples/pyplots/whats_new_1_subplot3d.py index 0e69530deec4..96886b0e1f8c 100644 --- a/examples/pyplots/whats_new_1_subplot3d.py +++ b/examples/pyplots/whats_new_1_subplot3d.py @@ -5,7 +5,9 @@ Create two three-dimensional plots in the same figure. """ -from mpl_toolkits.mplot3d.axes3d import Axes3D +# This import registers the 3D projection, but is otherwise unused. +from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import + from matplotlib import cm #from matplotlib.ticker import LinearLocator, FixedLocator, FormatStrFormatter import matplotlib.pyplot as plt