From 7b0e9ea06cc291a1021ee590806e2cf08ec40105 Mon Sep 17 00:00:00 2001 From: stonebig Date: Sat, 3 Apr 2021 16:46:04 +0200 Subject: [PATCH] Matplotlib-3.4.0 compatibility fix --- docs/Winpython_checker.ipynb | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/docs/Winpython_checker.ipynb b/docs/Winpython_checker.ipynb index beb362f..e2223ca 100644 --- a/docs/Winpython_checker.ipynb +++ b/docs/Winpython_checker.ipynb @@ -14,9 +14,9 @@ "outputs": [], "source": [ "import warnings\n", - "warnings.filterwarnings(\"ignore\", category=DeprecationWarning)\n", - "warnings.filterwarnings(\"ignore\", category=UserWarning)\n", - "warnings.filterwarnings(\"ignore\", category=FutureWarning)\n", + "#warnings.filterwarnings(\"ignore\", category=DeprecationWarning)\n", + "#warnings.filterwarnings(\"ignore\", category=UserWarning)\n", + "#warnings.filterwarnings(\"ignore\", category=FutureWarning)\n", "# warnings.filterwarnings(\"ignore\") # would silence all warnings" ] }, @@ -192,27 +192,33 @@ "metadata": {}, "outputs": [], "source": [ - "# Matplotlib\n", + "# Matplotlib 3.4.1\n", "# for more examples, see: http://matplotlib.org/gallery.html\n", "from mpl_toolkits.mplot3d import axes3d\n", "import matplotlib.pyplot as plt\n", "from matplotlib import cm\n", "\n", - "fig = plt.figure()\n", - "ax = fig.gca(projection='3d')\n", + "ax = plt.figure().add_subplot(projection='3d')\n", "X, Y, Z = axes3d.get_test_data(0.05)\n", + "\n", + "# Plot the 3D surface\n", "ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3)\n", + "\n", + "# Plot projections of the contours for each dimension. By choosing offsets\n", + "# that match the appropriate axes limits, the projected contours will sit on\n", + "# the 'walls' of the graph\n", "cset = ax.contourf(X, Y, Z, zdir='z', offset=-100, cmap=cm.coolwarm)\n", "cset = ax.contourf(X, Y, Z, zdir='x', offset=-40, cmap=cm.coolwarm)\n", "cset = ax.contourf(X, Y, Z, zdir='y', offset=40, cmap=cm.coolwarm)\n", "\n", - "ax.set_xlabel('X')\n", "ax.set_xlim(-40, 40)\n", - "ax.set_ylabel('Y')\n", "ax.set_ylim(-40, 40)\n", - "ax.set_zlabel('Z')\n", "ax.set_zlim(-100, 100)\n", "\n", + "ax.set_xlabel('X')\n", + "ax.set_ylabel('Y')\n", + "ax.set_zlabel('Z')\n", + "\n", "plt.show()" ] }, @@ -952,7 +958,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.0rc1" + "version": "3.9.2" }, "widgets": { "state": {