|
11 | 11 |
|
12 | 12 | from mpl_toolkits.mplot3d import axes3d |
13 | 13 | import matplotlib.pyplot as plt |
14 | | -from matplotlib import cm |
| 14 | +from matplotlib.cm import coolwarm as cmap |
15 | 15 |
|
16 | 16 | ax = plt.figure().add_subplot(projection='3d') |
17 | 17 | X, Y, Z = axes3d.get_test_data(0.05) |
18 | 18 |
|
19 | 19 | # Plot the 3D surface |
20 | | -ax.plot_surface(X, Y, Z, edgecolor='black', rstride=8, cstride=8, alpha=0.3) |
| 20 | +ax.plot_surface(X, Y, Z, edgecolor=cmap(0), lw=0.5, rstride=8, cstride=8, |
| 21 | + alpha=0.3) |
21 | 22 |
|
22 | 23 | # Plot projections of the contours for each dimension. By choosing offsets |
23 | 24 | # that match the appropriate axes limits, the projected contours will sit on |
24 | 25 | # the 'walls' of the graph |
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) |
| 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) |
28 | 29 |
|
29 | 30 | ax.set(xlim=(-40, 40), ylim=(-40, 40), zlim=(-100, 100), |
30 | 31 | xlabel='X', ylabel='Y', zlabel='Z') |
|
0 commit comments