Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Prefer add_subplot(foo=bar) to subplots(subplot_kw={"foo": bar}).#14411

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
anntzer wants to merge1 commit intomatplotlib:mainfromanntzer:subplot_kw
Closed
Show file tree
Hide file tree
Changes fromall 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
2 changes: 1 addition & 1 deletiongalleries/examples/misc/custom_projection.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -439,7 +439,7 @@ def _get_core_transform(self, resolution):
import matplotlib.pyplot as plt

# Now make a simple example using the custom projection.
fig,ax = plt.subplots(subplot_kw={'projection': 'custom_hammer'})
ax = plt.figure().add_subplot(projection="custom_hammer")
ax.plot([-1, 1, 1], [-1, -1, 1], "o-")
ax.grid()

Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/mplot3d/custom_shaded_3d_surface.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -24,7 +24,7 @@
x, y, z = x[region], y[region], z[region]

# Set up plot
fig,ax = plt.subplots(subplot_kw=dict(projection='3d'))
ax = plt.figure().add_subplot(projection="3d")

ls = LightSource(270, 45)
# To use a custom hillshading mode, override the built-in shading and pass
Expand Down
6 changes: 3 additions & 3 deletionsgalleries/examples/mplot3d/stem3d_demo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,7 @@
y = np.sin(theta - np.pi/2)
z = theta

fig,ax = plt.subplots(subplot_kw=dict(projection='3d'))
ax = plt.figure().add_subplot(projection="3d")
ax.stem(x, y, z)

plt.show()
Expand All@@ -28,7 +28,7 @@
# configurable via keyword arguments. For more advanced control adapt the line
# objects returned by `~mpl_toolkits.mplot3d.axes3d.Axes3D.stem`.

fig,ax = plt.subplots(subplot_kw=dict(projection='3d'))
ax = plt.figure().add_subplot(projection="3d")
markerline, stemlines, baseline = ax.stem(
x, y, z, linefmt='grey', markerfmt='D', bottom=np.pi)
markerline.set_markerfacecolor('none')
Expand All@@ -44,7 +44,7 @@
# For examples, by setting ``orientation='x'``, the stems are projected along
# the *x*-direction, and the baseline is in the *yz*-plane.

fig,ax = plt.subplots(subplot_kw=dict(projection='3d'))
ax = plt.figure().add_subplot(projection="3d")
markerline, stemlines, baseline = ax.stem(x, y, z, bottom=-1, orientation='x')
ax.set(xlabel='x', ylabel='y', zlabel='z')

Expand Down
2 changes: 1 addition & 1 deletiongalleries/examples/pie_and_polar_charts/polar_demo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,7 +11,7 @@
r = np.arange(0, 2, 0.01)
theta = 2 * np.pi * r

fig,ax = plt.subplots(subplot_kw={'projection': 'polar'})
ax = plt.figure().add_subplot(projection="polar")
ax.plot(theta, r)
ax.set_rmax(2)
ax.set_rticks([0.5, 1, 1.5, 2]) # Less radial ticks
Expand Down
13 changes: 5 additions & 8 deletionsgalleries/examples/shapes_and_collections/ellipse_demo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -22,16 +22,15 @@
angle=np.random.rand() * 360)
for i in range(NUM)]

fig, ax = plt.subplots(subplot_kw={'aspect': 'equal'})
fig, ax = plt.subplots()
ax.set(xlim=(0, 10), ylim=(0, 10), aspect="equal")

for e in ells:
ax.add_artist(e)
e.set_clip_box(ax.bbox)
e.set_alpha(np.random.rand())
e.set_facecolor(np.random.rand(3))

ax.set_xlim(0, 10)
ax.set_ylim(0, 10)

plt.show()

# %%
Expand All@@ -45,15 +44,13 @@
angle_step = 45 # degrees
angles = np.arange(0, 180, angle_step)

fig, ax = plt.subplots(subplot_kw={'aspect': 'equal'})
fig, ax = plt.subplots()
ax.set(xlim=(-2.2, 2.2), ylim=(-2.2, 2.2), aspect="equal")

for angle in angles:
ellipse = Ellipse((0, 0), 4, 2, angle=angle, alpha=0.1)
ax.add_artist(ellipse)

ax.set_xlim(-2.2, 2.2)
ax.set_ylim(-2.2, 2.2)

plt.show()

# %%
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -110,7 +110,7 @@
# The text in the example is placed in the fractional figure coordinate system.
# Text keyword arguments like horizontal and vertical alignment are respected.

fig,ax = plt.subplots(subplot_kw=dict(projection='polar'),figsize=(3, 3))
ax = plt.figure(figsize=(3, 3)).add_subplot(projection='polar')
r = np.arange(0, 1, 0.001)
theta = 2*2*np.pi*r
line, = ax.plot(theta, r)
Expand Down
4 changes: 2 additions & 2 deletionsgalleries/examples/widgets/lasso_selector_demo_sgskip.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,8 +81,8 @@ def disconnect(self):

data = np.random.rand(100, 2)

subplot_kw = dict(xlim=(0, 1), ylim=(0, 1), autoscale_on=False)
fig, ax = plt.subplots(subplot_kw=subplot_kw)
fig, ax = plt.subplots()
ax.set(xlim=(0, 1), ylim=(0, 1))

pts = ax.scatter(data[:, 0], data[:, 1], s=80)
selector = SelectFromCollection(ax, pts)
Expand Down
2 changes: 1 addition & 1 deletiongalleries/plot_types/3D/scatter3d_simple.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,7 +19,7 @@
zs = rng.uniform(-50, -25, n)

# Plot
fig,ax = plt.subplots(subplot_kw={"projection": "3d"})
ax = plt.figure().add_subplot(projection="3d")
ax.scatter(xs, ys, zs)

ax.set(xticklabels=[],
Expand Down
2 changes: 1 addition & 1 deletiongalleries/plot_types/3D/surface3d_simple.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,7 +20,7 @@
Z = np.sin(R)

# Plot the surface
fig,ax = plt.subplots(subplot_kw={"projection": "3d"})
ax = plt.figure().add_subplot(projection="3d")
ax.plot_surface(X, Y, Z, vmin=Z.min() * 2, cmap=cm.Blues)

ax.set(xticklabels=[],
Expand Down
2 changes: 1 addition & 1 deletiongalleries/plot_types/3D/trisurf3d_simple.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,7 +25,7 @@
z = np.sin(-x*y)

# Plot
fig,ax = plt.subplots(subplot_kw={'projection': '3d'})
ax = plt.figure().add_subplot(projection="3d")
ax.plot_trisurf(x, y, z, vmin=z.min() * 2, cmap=cm.Blues)

ax.set(xticklabels=[],
Expand Down
2 changes: 1 addition & 1 deletiongalleries/plot_types/3D/voxels_simple.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -21,7 +21,7 @@
voxelarray = cube1 | cube2

# Plot
fig,ax = plt.subplots(subplot_kw={"projection": "3d"})
ax = plt.figure().add_subplot(projection="3d")
ax.voxels(voxelarray, edgecolor='k')

ax.set(xticklabels=[],
Expand Down
2 changes: 1 addition & 1 deletiongalleries/plot_types/3D/wire3d_simple.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,7 +15,7 @@
X, Y, Z = axes3d.get_test_data(0.05)

# Plot
fig,ax = plt.subplots(subplot_kw={"projection": "3d"})
ax = plt.figure().add_subplot(projection="3d")
ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10)

ax.set(xticklabels=[],
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp