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

Skip to content

Commit ef96fef

Browse files
authored
Merge pull request #21166 from anntzer/c3
Cleanup contour(f)3d examples.
2 parents 1357c52 + c66fd46 commit ef96fef

File tree

5 files changed

+15
-32
lines changed

5 files changed

+15
-32
lines changed

examples/mplot3d/contour3d.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
ax = plt.figure().add_subplot(projection='3d')
1515
X, Y, Z = axes3d.get_test_data(0.05)
1616

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

2019
plt.show()

examples/mplot3d/contour3d_2.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313

1414
ax = plt.figure().add_subplot(projection='3d')
1515
X, Y, Z = axes3d.get_test_data(0.05)
16-
17-
cset = ax.contour(X, Y, Z, extend3d=True, cmap=cm.coolwarm)
18-
19-
ax.clabel(cset, fontsize=9, inline=True)
16+
ax.contour(X, Y, Z, extend3d=True, cmap=cm.coolwarm)
2017

2118
plt.show()

examples/mplot3d/contour3d_3.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,12 @@
2121

2222
# Plot projections of the contours for each dimension. By choosing offsets
2323
# that match the appropriate axes limits, the projected contours will sit on
24-
# the 'walls' of the graph
25-
cset = ax.contour(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm)
26-
cset = ax.contour(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm)
27-
cset = ax.contour(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)
28-
29-
ax.set_xlim(-40, 40)
30-
ax.set_ylim(-40, 40)
31-
ax.set_zlim(-100, 100)
32-
33-
ax.set_xlabel('X')
34-
ax.set_ylabel('Y')
35-
ax.set_zlabel('Z')
24+
# the 'walls' of the graph.
25+
ax.contour(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm)
26+
ax.contour(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm)
27+
ax.contour(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)
28+
29+
ax.set(xlim=(-40, 40), ylim=(-40, 40), zlim=(-100, 100),
30+
xlabel='X', ylabel='Y', zlabel='Z')
3631

3732
plt.show()

examples/mplot3d/contourf3d.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616

1717
ax = plt.figure().add_subplot(projection='3d')
1818
X, Y, Z = axes3d.get_test_data(0.05)
19-
20-
cset = ax.contourf(X, Y, Z, cmap=cm.coolwarm)
21-
22-
ax.clabel(cset, fontsize=9, inline=True)
19+
ax.contourf(X, Y, Z, cmap=cm.coolwarm)
2320

2421
plt.show()

examples/mplot3d/contourf3d_2.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,11 @@
2222
# Plot projections of the contours for each dimension. By choosing offsets
2323
# that match the appropriate axes limits, the projected contours will sit on
2424
# the 'walls' of the graph
25-
cset = ax.contourf(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm)
26-
cset = ax.contourf(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm)
27-
cset = ax.contourf(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)
25+
ax.contourf(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm)
26+
ax.contourf(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm)
27+
ax.contourf(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)
2828

29-
ax.set_xlim(-40, 40)
30-
ax.set_ylim(-40, 40)
31-
ax.set_zlim(-100, 100)
32-
33-
ax.set_xlabel('X')
34-
ax.set_ylabel('Y')
35-
ax.set_zlabel('Z')
29+
ax.set(xlim=(-40, 40), ylim=(-40, 40), zlim=(-100, 100),
30+
xlabel='X', ylabel='Y', zlabel='Z')
3631

3732
plt.show()

0 commit comments

Comments
 (0)