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

Commit ff7c43a

Browse filesBrowse files
committed
Specifying the color map and the edge color as strings
1 parent 85e6634 commit ff7c43a
Copy full SHA for ff7c43a

File tree

Expand file treeCollapse file tree

2 files changed

+8
-14
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-14
lines changed

‎examples/mplot3d/contour3d_3.py

Copy file name to clipboardExpand all lines: examples/mplot3d/contour3d_3.py
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,27 @@
22
=====================================
33
Project contour profiles onto a graph
44
=====================================
5-
65
Demonstrates displaying a 3D surface while also projecting contour 'profiles'
76
onto the 'walls' of the graph.
8-
97
See :doc:`contourf3d_2` for the filled version.
108
"""
119

1210
from mpl_toolkits.mplot3d import axes3d
1311
import matplotlib.pyplot as plt
14-
from matplotlib.cm import coolwarm as cmap
1512

1613
ax = plt.figure().add_subplot(projection='3d')
1714
X, Y, Z = axes3d.get_test_data(0.05)
1815

1916
# Plot the 3D surface
20-
ax.plot_surface(X, Y, Z, edgecolor=cmap(0), lw=0.5, rstride=8, cstride=8,
17+
ax.plot_surface(X, Y, Z, edgecolor='royalblue', lw=0.5, rstride=8, cstride=8,
2118
alpha=0.3)
2219

2320
# Plot projections of the contours for each dimension. By choosing offsets
2421
# that match the appropriate axes limits, the projected contours will sit on
2522
# the 'walls' of the graph.
26-
ax.contour(X, Y, Z, zdir='z', offset=-100, cmap=cmap)
27-
ax.contour(X, Y, Z, zdir='x', offset=-40, cmap=cmap)
28-
ax.contour(X, Y, Z, zdir='y', offset=40, cmap=cmap)
23+
ax.contour(X, Y, Z, zdir='z', offset=-100, cmap='coolwarm')
24+
ax.contour(X, Y, Z, zdir='x', offset=-40, cmap='coolwarm')
25+
ax.contour(X, Y, Z, zdir='y', offset=40, cmap='coolwarm')
2926

3027
ax.set(xlim=(-40, 40), ylim=(-40, 40), zlim=(-100, 100),
3128
xlabel='X', ylabel='Y', zlabel='Z')

‎examples/mplot3d/contourf3d_2.py

Copy file name to clipboardExpand all lines: examples/mplot3d/contourf3d_2.py
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,27 @@
22
===================================
33
Project filled contour onto a graph
44
===================================
5-
65
Demonstrates displaying a 3D surface while also projecting filled contour
76
'profiles' onto the 'walls' of the graph.
8-
97
See :doc:`contour3d_3` for the unfilled version.
108
"""
119

1210
from mpl_toolkits.mplot3d import axes3d
1311
import matplotlib.pyplot as plt
14-
from matplotlib.cm import coolwarm as cmap
1512

1613
ax = plt.figure().add_subplot(projection='3d')
1714
X, Y, Z = axes3d.get_test_data(0.05)
1815

1916
# Plot the 3D surface
20-
ax.plot_surface(X, Y, Z, edgecolor=cmap(0), lw=0.5, rstride=8, cstride=8,
17+
ax.plot_surface(X, Y, Z, edgecolor='royalblue', lw=0.5, rstride=8, cstride=8,
2118
alpha=0.3)
2219

2320
# Plot projections of the contours for each dimension. By choosing offsets
2421
# that match the appropriate axes limits, the projected contours will sit on
2522
# the 'walls' of the graph
26-
ax.contourf(X, Y, Z, zdir='z', offset=-100, cmap=cmap)
27-
ax.contourf(X, Y, Z, zdir='x', offset=-40, cmap=cmap)
28-
ax.contourf(X, Y, Z, zdir='y', offset=40, cmap=cmap)
23+
ax.contourf(X, Y, Z, zdir='z', offset=-100, cmap='coolwarm')
24+
ax.contourf(X, Y, Z, zdir='x', offset=-40, cmap='coolwarm')
25+
ax.contourf(X, Y, Z, zdir='y', offset=40, cmap='coolwarm')
2926

3027
ax.set(xlim=(-40, 40), ylim=(-40, 40), zlim=(-100, 100),
3128
xlabel='X', ylabel='Y', zlabel='Z')

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.