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

Skip to content

Avoid demo'ing passing kwargs to gca(). #18419

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

Merged
merged 1 commit into from
Sep 7, 2020
Merged
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
3 changes: 1 addition & 2 deletions examples/mplot3d/2dcollections3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
import numpy as np
import matplotlib.pyplot as plt

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

# Plot a sin curve using the x and y axes.
x = np.linspace(0, 1, 100)
Expand Down
7 changes: 2 additions & 5 deletions examples/mplot3d/contour3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
import matplotlib.pyplot as plt
from matplotlib import cm

fig = plt.figure()
ax = fig.gca(projection='3d')
ax = plt.figure().add_subplot(projection='3d')
X, Y, Z = axes3d.get_test_data(0.05)

# Plot contour curves
cset = ax.contour(X, Y, Z, cmap=cm.coolwarm)

cset = ax.contour(X, Y, Z, cmap=cm.coolwarm) # Plot contour curves
ax.clabel(cset, fontsize=9, inline=True)

plt.show()
3 changes: 1 addition & 2 deletions examples/mplot3d/contour3d_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
import matplotlib.pyplot as plt
from matplotlib import cm

fig = plt.figure()
ax = fig.gca(projection='3d')
ax = plt.figure().add_subplot(projection='3d')
X, Y, Z = axes3d.get_test_data(0.05)

cset = ax.contour(X, Y, Z, extend3d=True, cmap=cm.coolwarm)
Expand Down
3 changes: 1 addition & 2 deletions examples/mplot3d/contour3d_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
import matplotlib.pyplot as plt
from matplotlib import cm

fig = plt.figure()
ax = fig.gca(projection='3d')
ax = plt.figure().add_subplot(projection='3d')
X, Y, Z = axes3d.get_test_data(0.05)

# Plot the 3D surface
Expand Down
3 changes: 1 addition & 2 deletions examples/mplot3d/contourf3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
import matplotlib.pyplot as plt
from matplotlib import cm

fig = plt.figure()
ax = fig.gca(projection='3d')
ax = plt.figure().add_subplot(projection='3d')
X, Y, Z = axes3d.get_test_data(0.05)

cset = ax.contourf(X, Y, Z, cmap=cm.coolwarm)
Expand Down
3 changes: 1 addition & 2 deletions examples/mplot3d/contourf3d_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
import matplotlib.pyplot as plt
from matplotlib import cm

fig = plt.figure()
ax = fig.gca(projection='3d')
ax = plt.figure().add_subplot(projection='3d')
X, Y, Z = axes3d.get_test_data(0.05)

# Plot the 3D surface
Expand Down
3 changes: 1 addition & 2 deletions examples/mplot3d/errorbar3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import matplotlib.pyplot as plt
import numpy as np

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

# setting up a parametric curve
t = np.arange(0, 2*np.pi+.1, 0.01)
Expand Down
5 changes: 1 addition & 4 deletions examples/mplot3d/lines3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
import matplotlib.pyplot as plt


plt.rcParams['legend.fontsize'] = 10

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

# Prepare arrays x, y, z
theta = np.linspace(-4 * np.pi, 4 * np.pi, 100)
Expand Down
3 changes: 1 addition & 2 deletions examples/mplot3d/lorenz_attractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ def lorenz(x, y, z, s=10, r=28, b=2.667):


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

ax.plot(xs, ys, zs, lw=0.5)
ax.set_xlabel("X Axis")
Expand Down
3 changes: 1 addition & 2 deletions examples/mplot3d/offset.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
import numpy as np


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

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
3 changes: 1 addition & 2 deletions examples/mplot3d/polys3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ def polygon_under_graph(xlist, ylist):
return [(xlist[0], 0.), *zip(xlist, ylist), (xlist[-1], 0.)]


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

# Make verts a list such that verts[i] is a list of (x, y) pairs defining
# polygon i.
Expand Down
3 changes: 1 addition & 2 deletions examples/mplot3d/quiver3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
import matplotlib.pyplot as plt
import numpy as np

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

# Make the grid
x, y, z = np.meshgrid(np.arange(-0.8, 1, 0.2),
Expand Down
3 changes: 1 addition & 2 deletions examples/mplot3d/surface3d_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
import numpy as np


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

# Make data.
X = np.arange(-5, 5, 0.25)
Expand Down
15 changes: 6 additions & 9 deletions examples/mplot3d/text3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,17 @@

Functionality shown:

- Using the text function with three types of 'zdir' values: None, an axis
name (ex. 'x'), or a direction tuple (ex. (1, 1, 0)).
- Using the text function with the color keyword.

- Using the text2D function to place text on a fixed position on the ax
object.

- Using the text function with three types of 'zdir' values: None, an axis
name (ex. 'x'), or a direction tuple (ex. (1, 1, 0)).
- Using the text function with the color keyword.
- Using the text2D function to place text on a fixed position on the ax
object.
"""

import matplotlib.pyplot as plt


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

# Demo 1: zdir
zdirs = (None, 'x', 'y', 'z', (1, 1, 0), (1, 1, 1))
Expand Down
3 changes: 1 addition & 2 deletions examples/mplot3d/tricontour3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
y[triang.triangles].mean(axis=1))
< min_radius)

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

# Customize the view angle so it's easier to understand the plot.
Expand Down
3 changes: 1 addition & 2 deletions examples/mplot3d/tricontourf3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
y[triang.triangles].mean(axis=1))
< min_radius)

fig = plt.figure()
ax = fig.gca(projection='3d')
ax = plt.figure().add_subplot(projection='3d')
ax.tricontourf(triang, z, cmap=plt.cm.CMRmap)

# Customize the view angle so it's easier to understand the plot.
Expand Down
3 changes: 1 addition & 2 deletions examples/mplot3d/trisurf3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
# Compute z to make the pringle surface.
z = np.sin(-x*y)

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

ax.plot_trisurf(x, y, z, linewidth=0.2, antialiased=True)

Expand Down
3 changes: 1 addition & 2 deletions examples/mplot3d/voxels.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
colors[cube2] = 'green'

# and plot everything
fig = plt.figure()
ax = fig.gca(projection='3d')
ax = plt.figure().add_subplot(projection='3d')
ax.voxels(voxels, facecolors=colors, edgecolor='k')

plt.show()
4 changes: 2 additions & 2 deletions examples/mplot3d/voxels_numpy_logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

Demonstrates using `.Axes3D.voxels` with uneven coordinates.
"""

import matplotlib.pyplot as plt
import numpy as np

Expand Down Expand Up @@ -39,8 +40,7 @@ def explode(data):
y[:, 1::2, :] += 0.95
z[:, :, 1::2] += 0.95

fig = plt.figure()
ax = fig.gca(projection='3d')
ax = plt.figure().add_subplot(projection='3d')
ax.voxels(x, y, z, filled_2, facecolors=fcolors_2, edgecolors=ecolors_2)

plt.show()
3 changes: 1 addition & 2 deletions examples/mplot3d/voxels_rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def midpoints(x):
colors[..., 2] = bc

# and plot everything
fig = plt.figure()
ax = fig.gca(projection='3d')
ax = plt.figure().add_subplot(projection='3d')
ax.voxels(r, g, b, sphere,
facecolors=colors,
edgecolors=np.clip(2*colors - 0.5, 0, 1), # brighter
Expand Down
3 changes: 1 addition & 2 deletions examples/mplot3d/voxels_torus.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ def midpoints(x):
colors = matplotlib.colors.hsv_to_rgb(hsv)

# and plot everything
fig = plt.figure()
ax = fig.gca(projection='3d')
ax = plt.figure().add_subplot(projection='3d')
ax.voxels(x, y, z, sphere,
facecolors=colors,
edgecolors=np.clip(2*colors - 0.5, 0, 1), # brighter
Expand Down
Loading