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

Replaced noqa-comments by using Axes3D.name instead of '3d' for proje… #12249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions 5 examples/frontpage/3D.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
This example reproduces the frontpage 3D example.

"""
# This import registers the 3D projection, but is otherwise unused.
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
from mpl_toolkits.mplot3d import Axes3D

from matplotlib import cbook
from matplotlib import cm
Expand All @@ -26,7 +25,7 @@
region = np.s_[5:50, 5:50]
x, y, z = x[region], y[region], z[region]

fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
fig, ax = plt.subplots(subplot_kw=dict(projection=Axes3D.name))

ls = LightSource(270, 45)
# To use a custom hillshading mode, override the built-in shading and pass
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/2dcollections3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
selective axes of a 3D plot.
"""

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

import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure()
ax = fig.gca(projection='3d')
ax = fig.gca(projection=Axes3D.name)

# Plot a sin curve using the x and y axes.
x = np.linspace(0, 1, 100)
Expand Down
7 changes: 3 additions & 4 deletions 7 examples/mplot3d/3d_bars.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@

import numpy as np
import matplotlib.pyplot as plt
# This import registers the 3D projection, but is otherwise unused.
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
from mpl_toolkits.mplot3d import Axes3D


# setup the figure and axes
fig = plt.figure(figsize=(8, 3))
ax1 = fig.add_subplot(121, projection='3d')
ax2 = fig.add_subplot(122, projection='3d')
ax1 = fig.add_subplot(121, projection=Axes3D.name)
ax2 = fig.add_subplot(122, projection=Axes3D.name)

# fake data
_x = np.arange(4)
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/bars3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
planes y=0, y=1, etc.
"""

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

import matplotlib.pyplot as plt
import numpy as np
Expand All @@ -18,7 +17,7 @@


fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax = fig.add_subplot(111, projection=Axes3D.name)

colors = ['r', 'g', 'b', 'y']
yticks = [3, 2, 1, 0]
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/custom_shaded_3d_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
Demonstrates using custom hillshading in a 3D surface plot.
"""

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

from matplotlib import cbook
from matplotlib import cm
Expand All @@ -28,7 +27,7 @@
x, y, z = x[region], y[region], z[region]

# Set up plot
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
fig, ax = plt.subplots(subplot_kw=dict(projection=Axes3D.name))

ls = LightSource(270, 45)
# To use a custom hillshading mode, override the built-in shading and pass
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/hist3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
Demo of a histogram for 2 dimensional data as a bar graph in 3D.
"""

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

import matplotlib.pyplot as plt
import numpy as np
Expand All @@ -17,7 +16,7 @@


fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax = fig.add_subplot(111, projection=Axes3D.name)
x, y = np.random.rand(2, 100) * 4
hist, xedges, yedges = np.histogram2d(x, y, bins=4, range=[[0, 4], [0, 4]])

Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/lines3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
This example demonstrates plotting a parametric curve in 3D.
'''

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

import numpy as np
import matplotlib.pyplot as plt
Expand All @@ -16,7 +15,7 @@
plt.rcParams['legend.fontsize'] = 10

fig = plt.figure()
ax = fig.gca(projection='3d')
ax = fig.gca(projection=Axes3D.name)

# Prepare arrays x, y, z
theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/lorenz_attractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@

import numpy as np
import matplotlib.pyplot as plt
# This import registers the 3D projection, but is otherwise unused.
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
from mpl_toolkits.mplot3d import Axes3D


def lorenz(x, y, z, s=10, r=28, b=2.667):
Expand Down Expand Up @@ -56,7 +55,7 @@ def lorenz(x, y, z, s=10, r=28, b=2.667):

# Plot
fig = plt.figure()
ax = fig.gca(projection='3d')
ax = fig.gca(projection=Axes3D.name)

ax.plot(xs, ys, zs, lw=0.5)
ax.set_xlabel("X Axis")
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/mixed_subplots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

This example shows a how to plot a 2D and 3D plot on the same figure.
"""
# This import registers the 3D projection, but is otherwise unused.
from mpl_toolkits.mplot3d import Axes3D # noqa: F401 unused import
from mpl_toolkits.mplot3d import Axes3D

import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -35,7 +34,7 @@ def f(t):
ax.set_ylabel('Damped oscillation')

# Second subplot
ax = fig.add_subplot(2, 1, 2, projection='3d')
ax = fig.add_subplot(2, 1, 2, projection=Axes3D.name)

X = np.arange(-5, 5, 0.25)
Y = np.arange(-5, 5, 0.25)
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/offset.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@
automatically trigger it.
'''

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

import matplotlib.pyplot as plt
import numpy as np


fig = plt.figure()
ax = fig.gca(projection='3d')
ax = fig.gca(projection=Axes3D.name)

X, Y = np.mgrid[0:6*np.pi:0.25, 0:4*np.pi:0.25]
Z = np.sqrt(np.abs(np.cos(X) + np.cos(Y)))
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/pathpatch3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from matplotlib.patches import Circle, PathPatch
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
from mpl_toolkits.mplot3d import Axes3D
import mpl_toolkits.mplot3d.art3d as art3d


Expand Down Expand Up @@ -43,7 +42,7 @@ def text3d(ax, xyz, s, zdir="z", size=None, angle=0, usetex=False, **kwargs):


fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax = fig.add_subplot(111, projection=Axes3D.name)

# Draw a circle on the x=0 'wall'
p = Circle((5, 5), 3)
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/polys3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
of 'jagged stained glass' effect.
"""

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

from matplotlib.collections import PolyCollection
import matplotlib.pyplot as plt
Expand All @@ -36,7 +35,7 @@ def polygon_under_graph(xlist, ylist):


fig = plt.figure()
ax = fig.gca(projection='3d')
ax = fig.gca(projection=Axes3D.name)

# Make verts a list, verts[i] will be a list of (x,y) pairs defining polygon i
verts = []
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/quiver3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
Demonstrates plotting directional arrows at points on a 3d meshgrid.
'''

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

import matplotlib.pyplot as plt
import numpy as np

fig = plt.figure()
ax = fig.gca(projection='3d')
ax = fig.gca(projection=Axes3D.name)

# Make the grid
x, y, z = np.meshgrid(np.arange(-0.8, 1, 0.2),
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/scatter3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
Demonstration of a basic scatterplot in 3D.
'''

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

import matplotlib.pyplot as plt
import numpy as np
Expand All @@ -24,7 +23,7 @@ def randrange(n, vmin, vmax):
return (vmax - vmin)*np.random.rand(n) + vmin

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax = fig.add_subplot(111, projection=Axes3D.name)

n = 100

Expand Down
7 changes: 3 additions & 4 deletions 7 examples/mplot3d/subplot3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
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
from mpl_toolkits.mplot3d import Axes3D


# set up a figure twice as wide as it is tall
Expand All @@ -22,7 +21,7 @@
# First subplot
#===============
# set up the axes for the first plot
ax = fig.add_subplot(1, 2, 1, projection='3d')
ax = fig.add_subplot(1, 2, 1, projection=Axes3D.name)

# plot a 3D surface like in the example mplot3d/surface3d_demo
X = np.arange(-5, 5, 0.25)
Expand All @@ -39,7 +38,7 @@
# Second subplot
#===============
# set up the axes for the second plot
ax = fig.add_subplot(1, 2, 2, projection='3d')
ax = fig.add_subplot(1, 2, 2, projection=Axes3D.name)

# plot a 3D wireframe like in the example mplot3d/wire3d_demo
X, Y, Z = get_test_data(0.05)
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/surface3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
z axis tick labels.
'''

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

import matplotlib.pyplot as plt
from matplotlib import cm
Expand All @@ -20,7 +19,7 @@


fig = plt.figure()
ax = fig.gca(projection='3d')
ax = fig.gca(projection=Axes3D.name)

# Make data.
X = np.arange(-5, 5, 0.25)
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/surface3d_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
Demonstrates a very basic plot of a 3D surface using a solid color.
'''

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

import matplotlib.pyplot as plt
import numpy as np


fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax = fig.add_subplot(111, projection=Axes3D.name)

# Make data
u = np.linspace(0, 2 * np.pi, 100)
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/surface3d_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
Demonstrates plotting a 3D surface colored in a checkerboard pattern.
'''

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

import matplotlib.pyplot as plt
from matplotlib.ticker import LinearLocator
import numpy as np


fig = plt.figure()
ax = fig.gca(projection='3d')
ax = fig.gca(projection=Axes3D.name)

# Make data.
X = np.arange(-5, 5, 0.25)
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/surface3d_radial.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
Example contributed by Armin Moser.
'''

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

import matplotlib.pyplot as plt
import numpy as np


fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax = fig.add_subplot(111, projection=Axes3D.name)

# Create the mesh in polar coordinates and compute corresponding Z.
r = np.linspace(0, 1.25, 50)
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/text3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@

'''

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

import matplotlib.pyplot as plt


fig = plt.figure()
ax = fig.gca(projection='3d')
ax = fig.gca(projection=Axes3D.name)

# Demo 1: zdir
zdirs = (None, 'x', 'y', 'z', (1, 1, 0), (1, 1, 1))
Expand Down
5 changes: 2 additions & 3 deletions 5 examples/mplot3d/tricontour3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
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
from mpl_toolkits.mplot3d import Axes3D

import matplotlib.pyplot as plt
import matplotlib.tri as tri
Expand Down Expand Up @@ -39,7 +38,7 @@
< min_radius)

fig = plt.figure()
ax = fig.gca(projection='3d')
ax = fig.gca(projection=Axes3D.name)
ax.tricontour(triang, z, cmap=plt.cm.CMRmap)

# Customize the view angle so it's easier to understand the plot.
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.