|
14 | 14 | "outputs": [], |
15 | 15 | "source": [ |
16 | 16 | "import warnings\n", |
17 | | - "warnings.filterwarnings(\"ignore\", category=DeprecationWarning)\n", |
18 | | - "warnings.filterwarnings(\"ignore\", category=UserWarning)\n", |
19 | | - "warnings.filterwarnings(\"ignore\", category=FutureWarning)\n", |
| 17 | + "#warnings.filterwarnings(\"ignore\", category=DeprecationWarning)\n", |
| 18 | + "#warnings.filterwarnings(\"ignore\", category=UserWarning)\n", |
| 19 | + "#warnings.filterwarnings(\"ignore\", category=FutureWarning)\n", |
20 | 20 | "# warnings.filterwarnings(\"ignore\") # would silence all warnings" |
21 | 21 | ] |
22 | 22 | }, |
|
192 | 192 | "metadata": {}, |
193 | 193 | "outputs": [], |
194 | 194 | "source": [ |
195 | | - "# Matplotlib\n", |
| 195 | + "# Matplotlib 3.4.1\n", |
196 | 196 | "# for more examples, see: http://matplotlib.org/gallery.html\n", |
197 | 197 | "from mpl_toolkits.mplot3d import axes3d\n", |
198 | 198 | "import matplotlib.pyplot as plt\n", |
199 | 199 | "from matplotlib import cm\n", |
200 | 200 | "\n", |
201 | | - "fig = plt.figure()\n", |
202 | | - "ax = fig.gca(projection='3d')\n", |
| 201 | + "ax = plt.figure().add_subplot(projection='3d')\n", |
203 | 202 | "X, Y, Z = axes3d.get_test_data(0.05)\n", |
| 203 | + "\n", |
| 204 | + "# Plot the 3D surface\n", |
204 | 205 | "ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3)\n", |
| 206 | + "\n", |
| 207 | + "# Plot projections of the contours for each dimension. By choosing offsets\n", |
| 208 | + "# that match the appropriate axes limits, the projected contours will sit on\n", |
| 209 | + "# the 'walls' of the graph\n", |
205 | 210 | "cset = ax.contourf(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm)\n", |
206 | 211 | "cset = ax.contourf(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm)\n", |
207 | 212 | "cset = ax.contourf(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)\n", |
208 | 213 | "\n", |
209 | | - "ax.set_xlabel('X')\n", |
210 | 214 | "ax.set_xlim(-40, 40)\n", |
211 | | - "ax.set_ylabel('Y')\n", |
212 | 215 | "ax.set_ylim(-40, 40)\n", |
213 | | - "ax.set_zlabel('Z')\n", |
214 | 216 | "ax.set_zlim(-100, 100)\n", |
215 | 217 | "\n", |
| 218 | + "ax.set_xlabel('X')\n", |
| 219 | + "ax.set_ylabel('Y')\n", |
| 220 | + "ax.set_zlabel('Z')\n", |
| 221 | + "\n", |
216 | 222 | "plt.show()" |
217 | 223 | ] |
218 | 224 | }, |
|
952 | 958 | "name": "python", |
953 | 959 | "nbconvert_exporter": "python", |
954 | 960 | "pygments_lexer": "ipython3", |
955 | | - "version": "3.9.0rc1" |
| 961 | + "version": "3.9.2" |
956 | 962 | }, |
957 | 963 | "widgets": { |
958 | 964 | "state": { |
|
0 commit comments