From 9b79d529b091dabbe87c9771643f791bb2282c65 Mon Sep 17 00:00:00 2001 From: Benn Roth Date: Wed, 11 Jul 2018 13:53:25 -0500 Subject: [PATCH 1/9] Add knot to Ugly Tie shape Added geometry to the Ugly Tie polygon to look like a knot. It remains a single polygon so color will affect both visible parts. At large zooms/resolutions a connection between the right side of the knot and the main tie is visible because the points on right side of the knot are not perfectly in-line with the upper right corner of the tie where the two larger parts of the shape are visible. If this becomes an issue, doing some math to find evenly dividing, aligned points near the current values would make the connecting section of the polygon zero width. --- AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb b/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb index d7bbf0e..70384ab 100644 --- a/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb +++ b/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb @@ -512,8 +512,8 @@ "source": [ "mpl.rc('axes', prop_cycle=cycler('color', ['r', 'orange', 'c', 'y']) +\n", " cycler('hatch', ['x', 'xx-', '+O.', '*']))\n", - "x = np.array([0.4, 0.2, 0.5, 0.8, 0.6])\n", - "y = [0, -5, -6, -5, 0]\n", + "x = np.array([0.7, 0.3, 0.385, 0.6153, 0.6, 0.4, 0.2, 0.5, 0.8, 0.6])\n", + "y = [0.65, 0.65, 0.1, 0.1, 0, 0, -5, -6, -5, 0]\n", "plt.fill(x+1, y)\n", "plt.fill(x+2, y)\n", "plt.fill(x+3, y)\n", From 2fd6c31b53cd05ecd77cca1118d9655a94bb5133 Mon Sep 17 00:00:00 2001 From: Benn Roth Date: Fri, 13 Jul 2018 09:27:04 -0500 Subject: [PATCH 2/9] Removed invisible connecting geometry repeated first point in 5th position to close knot shape. Added `np.nan` non-rending connection point. --- AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb b/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb index 70384ab..110301a 100644 --- a/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb +++ b/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb @@ -512,8 +512,8 @@ "source": [ "mpl.rc('axes', prop_cycle=cycler('color', ['r', 'orange', 'c', 'y']) +\n", " cycler('hatch', ['x', 'xx-', '+O.', '*']))\n", - "x = np.array([0.7, 0.3, 0.385, 0.6153, 0.6, 0.4, 0.2, 0.5, 0.8, 0.6])\n", - "y = [0.65, 0.65, 0.1, 0.1, 0, 0, -5, -6, -5, 0]\n", + "x = np.array([0.7, 0.3, 0.385, 0.6153, 0.7, np.nan, 0.6, 0.4, 0.2, 0.5, 0.8, 0.6])\n", + "y = [0.65, 0.65, 0.1, 0.1, 0.65, np.nan, 0, 0, -5, -6, -5, 0]\n", "plt.fill(x+1, y)\n", "plt.fill(x+2, y)\n", "plt.fill(x+3, y)\n", From c96a9255ef1479d1b8263d30aecefdab4f9b97ab Mon Sep 17 00:00:00 2001 From: ggodreau Date: Sat, 27 Oct 2018 19:00:33 -0500 Subject: [PATCH 3/9] Fixes #26 - /mpl-data/sample_data/axes_grid folder appears to no longer exists as of matplotlib v2.2.2 - added /assets folder in repo containing dependent numpy pickle, 'bivariate_normal.npy' file - revised load of data in AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb to reflect this change - tested successfully with matplotlib v2.2.2 and python v3.6.6 --- ...tlib-Part2-Plotting_Methods_Overview.ipynb | 38 ++++++++++++++++-- assets/bivariate_normal.npy | Bin 0 -> 1880 bytes 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 assets/bivariate_normal.npy diff --git a/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb b/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb index 6ab58e8..f36cef2 100644 --- a/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb +++ b/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb @@ -269,6 +269,38 @@ "# Now you're on your own!\n" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "np.random.seed(1)\n", + "\n", + "# Generate data...\n", + "y_raw = np.random.randn(1000).cumsum() + 15\n", + "x_raw = np.linspace(0, 24, y_raw.size)\n", + "\n", + "# Get averages of every 100 samples...\n", + "x_pos = x_raw.reshape(-1, 100).min(axis=1)\n", + "y_avg = y_raw.reshape(-1, 100).mean(axis=1)\n", + "y_err = y_raw.reshape(-1, 100).ptp(axis=1)\n", + "\n", + "bar_width = x_pos[1] - x_pos[0]\n", + "\n", + "# Make a made up future prediction with a fake confidence\n", + "x_pred = np.linspace(0, 30)\n", + "y_max_pred = y_avg[0] + y_err[0] + 2.3 * x_pred\n", + "y_min_pred = y_avg[0] - y_err[0] + 1.2 * x_pred\n", + "\n", + "# Just so you don't have to guess at the colors...\n", + "barcolor, linecolor, fillcolor = 'wheat', 'salmon', 'lightblue'\n", + "\n", + "# Now you're on your own!\n" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -305,7 +337,7 @@ "outputs": [], "source": [ "from matplotlib.cbook import get_sample_data\n", - "data = np.load(get_sample_data('axes_grid/bivariate_normal.npy'))\n", + "data = np.load('assets/bivariate_normal.npy')\n", "\n", "fig, ax = plt.subplots()\n", "im = ax.imshow(data, cmap='gist_earth')\n", @@ -370,7 +402,7 @@ "outputs": [], "source": [ "from matplotlib.cbook import get_sample_data\n", - "data = np.load(get_sample_data('axes_grid/bivariate_normal.npy'))\n", + "data = np.load('assets/bivariate_normal.npy')\n", "\n", "fig, ax = plt.subplots()\n", "im = ax.imshow(data, cmap='seismic')\n", @@ -462,7 +494,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.5" + "version": "3.6.6" } }, "nbformat": 4, diff --git a/assets/bivariate_normal.npy b/assets/bivariate_normal.npy new file mode 100644 index 0000000000000000000000000000000000000000..b6b8dacdd0daecd53ef685f2a2dc29c98d5c6861 GIT binary patch literal 1880 zcmX|AeLNJ{8m6?@w|k|AjJb2;&S58qN?3txDq(VtzzprVUv_Y441f^WSsc=Xu`qKIa^c$D#jt9aU9vR$&lB zLg^=HL=v9pK(!}Y;EB{|S}ZLnDj=E`5~|pD4vM6Q%J=DEK{26nY`)vp0>9gKhXwu& zer;)XC8WM!i3iBmwDbomR~N~ihZ~C3XZ4}%zny5C?zirrU0wAhA)iNf_0{U#pm~9u=Sn}O;-UsA2dr9o+Gdcy=6|PX zM-V^V8_WtMZjtUm5PtQz)3-ar;hf`EI|pVYgsfrgTD^3Q@4Keoyyh3|^4XvEm~iXp z>?m1!<8yz)Ldte#^A50Y^?RHW>jrO(zQ3SXZ~{a+ea~N*@DItNg(P>Z(4!;qaR#+uP@$%uz zLzbLh)UuQpAlC;xcy0aXzC2(Q{LkoAay&@aJKto@RPt) zH>Y6?wk~bbDA_22FMdB#WLqYL+Pq~#(b=0|RpD7G@n?cFZX4UDCIChzoO<^?`wE`U zlXzjAEJzDEa6kFCUtxyXi?DAVg7&FW45w!p#1y@9-#IB@2!-z>3+7-lvx~>wxd1h{ z-{q7g&H;Ogq*<6Mg=9YFO?t}^2(t=(jHT^>cPb_S;Cu_(nI?6)b_pOf<4^DXNJSL> z5!Iiaspw+tmO*w{8cf$uZ45T$LVJ>PQ)qq%l%Fuh9ZnjCO9K;?jaV6E7Yo%>tLNaO z53@n1a~`myTexrV@4)lf;(jOI1k95<>1LECAYpyb&g#!Zl5N~yr)v1CAYjZA1xRpz2V`x%qD=sc8E5;z#`oDJEd$B$aNwZO3kisnkW z2qvseE7_EnuyIfE6Vtc-U^r`r`^2~c@jcik%HR;n_mwnrzmuRs+$dKtAw`TRejHcz zHM-@Jv>=HRqpbP9;6ILtP}kE8_i%>}6xWn!(U?(zis?bQfiD`7V8riWn?@UYK4j=q zaIG7)x!U*M_3uUN{+dmfJoJ)YqbqhS_GHpK^yRlP1%`Bemo&6hC4D4dG7W|Kd-v_SavZ6Q z^K$!y7hygB_4_mV`&;hVSiLeI{oRJ<^}U_QF78vIQ++2o{Y7eW^Okl*v)mjzRMdn_ zp0-vv+SMUhsm-z1!@nRepFCj&)) Date: Sat, 27 Oct 2018 19:08:06 -0500 Subject: [PATCH 4/9] Fixes #26 - removed redundant cell (typo on my part), line 272 --- ...tlib-Part2-Plotting_Methods_Overview.ipynb | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb b/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb index f36cef2..8239f9e 100644 --- a/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb +++ b/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb @@ -269,38 +269,6 @@ "# Now you're on your own!\n" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import numpy as np\n", - "import matplotlib.pyplot as plt\n", - "np.random.seed(1)\n", - "\n", - "# Generate data...\n", - "y_raw = np.random.randn(1000).cumsum() + 15\n", - "x_raw = np.linspace(0, 24, y_raw.size)\n", - "\n", - "# Get averages of every 100 samples...\n", - "x_pos = x_raw.reshape(-1, 100).min(axis=1)\n", - "y_avg = y_raw.reshape(-1, 100).mean(axis=1)\n", - "y_err = y_raw.reshape(-1, 100).ptp(axis=1)\n", - "\n", - "bar_width = x_pos[1] - x_pos[0]\n", - "\n", - "# Make a made up future prediction with a fake confidence\n", - "x_pred = np.linspace(0, 30)\n", - "y_max_pred = y_avg[0] + y_err[0] + 2.3 * x_pred\n", - "y_min_pred = y_avg[0] - y_err[0] + 1.2 * x_pred\n", - "\n", - "# Just so you don't have to guess at the colors...\n", - "barcolor, linecolor, fillcolor = 'wheat', 'salmon', 'lightblue'\n", - "\n", - "# Now you're on your own!\n" - ] - }, { "cell_type": "markdown", "metadata": {}, From bcf3d08fa31c9297c052efb977fb5ffd1e0cc9c5 Mon Sep 17 00:00:00 2001 From: JarnoRFB Date: Mon, 22 Apr 2019 16:38:36 +0200 Subject: [PATCH 5/9] Fix markers table for display in JupyterLab Before the changes, the table was not rendered properly. --- AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb b/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb index 110301a..fd654f2 100644 --- a/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb +++ b/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb @@ -102,17 +102,17 @@ "# Markers\n", "[Markers](http://matplotlib.org/api/markers_api.html) are commonly used in [`plot()`](http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.plot) and [`scatter()`](http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.scatter) plots, but also show up elsewhere. There is a wide set of markers available, and custom markers can even be specified.\n", "\n", - "marker | description ||marker | description ||marker | description ||marker | description \n", - ":----------|:--------------||:---------|:--------------||:---------|:--------------||:---------|:--------------\n", - "\".\" | point ||\"+\" | plus ||\",\" | pixel ||\"x\" | cross\n", - "\"o\" | circle ||\"D\" | diamond ||\"d\" | thin_diamond || |\n", - "\"8\" | octagon ||\"s\" | square ||\"p\" | pentagon ||\"\\*\" | star\n", - "\"|\" | vertical line||\"\\_\" | horizontal line ||\"h\" | hexagon1 ||\"H\" | hexagon2\n", - "0 | tickleft ||4 | caretleft ||\"<\" | triangle_left ||\"3\" | tri_left\n", - "1 | tickright ||5 | caretright ||\">\" | triangle_right||\"4\" | tri_right\n", - "2 | tickup ||6 | caretup ||\"^\" | triangle_up ||\"2\" | tri_up\n", - "3 | tickdown ||7 | caretdown ||\"v\" | triangle_down ||\"1\" | tri_down\n", - "\"None\" | nothing ||`None` | default ||\" \" | nothing ||\"\" | nothing" + "marker | description | marker | description |marker | description | marker | description \n", + ":----------|:--------------| :---------|:-------------- |:---------|:--------------| :---------|:--------------\n", + "\".\" | point | \"+\" | plus |\",\" | pixel | \"x\" | cross\n", + "\"o\" | circle | \"D\" | diamond |\"d\" | thin_diamond | |\n", + "\"8\" | octagon | \"s\" | square |\"p\" | pentagon | \"\\*\" | star\n", + "\"|\" | vertical line| \"\\_\" | horizontal line | \"h\" | hexagon1 | \"H\" | hexagon2\n", + "0 | tickleft | 4 | caretleft |\"<\" | triangle_left | \"3\" | tri_left\n", + "1 | tickright | 5 | caretright |\">\" | triangle_right| \"4\" | tri_right\n", + "2 | tickup | 6 | caretup |\"^\" | triangle_up | \"2\" | tri_up\n", + "3 | tickdown | 7 | caretdown |\"v\" | triangle_down | \"1\" | tri_down\n", + "\"None\" | nothing | `None` | default |\" \" | nothing |\"\" | nothing" ] }, { @@ -607,9 +607,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.5" + "version": "3.7.3" } }, "nbformat": 4, - "nbformat_minor": 1 + "nbformat_minor": 2 } From 47313848fbf84d580447d751b968381c4cae68fe Mon Sep 17 00:00:00 2001 From: JarnoRFB Date: Tue, 23 Apr 2019 22:47:07 +0200 Subject: [PATCH 6/9] Make text table more consistent --- AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb b/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb index fd654f2..e3c93fe 100644 --- a/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb +++ b/AnatomyOfMatplotlib-Part3-HowToSpeakMPL.ipynb @@ -102,17 +102,17 @@ "# Markers\n", "[Markers](http://matplotlib.org/api/markers_api.html) are commonly used in [`plot()`](http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.plot) and [`scatter()`](http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.scatter) plots, but also show up elsewhere. There is a wide set of markers available, and custom markers can even be specified.\n", "\n", - "marker | description | marker | description |marker | description | marker | description \n", - ":----------|:--------------| :---------|:-------------- |:---------|:--------------| :---------|:--------------\n", - "\".\" | point | \"+\" | plus |\",\" | pixel | \"x\" | cross\n", - "\"o\" | circle | \"D\" | diamond |\"d\" | thin_diamond | |\n", - "\"8\" | octagon | \"s\" | square |\"p\" | pentagon | \"\\*\" | star\n", - "\"|\" | vertical line| \"\\_\" | horizontal line | \"h\" | hexagon1 | \"H\" | hexagon2\n", - "0 | tickleft | 4 | caretleft |\"<\" | triangle_left | \"3\" | tri_left\n", - "1 | tickright | 5 | caretright |\">\" | triangle_right| \"4\" | tri_right\n", - "2 | tickup | 6 | caretup |\"^\" | triangle_up | \"2\" | tri_up\n", - "3 | tickdown | 7 | caretdown |\"v\" | triangle_down | \"1\" | tri_down\n", - "\"None\" | nothing | `None` | default |\" \" | nothing |\"\" | nothing" + "marker | description | marker | description | marker | description | marker | description \n", + ":----------|:--------------|:----------|:----------------|:---------|:--------------|:----------|:--------------\n", + "\".\" | point | \"+\" | plus | \",\" | pixel | \"x\" | cross\n", + "\"o\" | circle | \"D\" | diamond | \"d\" | thin_diamond | |\n", + "\"8\" | octagon | \"s\" | square | \"p\" | pentagon | \"\\*\" | star\n", + "\"|\" | vertical line| \"\\_\" | horizontal line | \"h\" | hexagon1 | \"H\" | hexagon2\n", + "0 | tickleft | 4 | caretleft | \"<\" | triangle_left | \"3\" | tri_left\n", + "1 | tickright | 5 | caretright | \">\" | triangle_right| \"4\" | tri_right\n", + "2 | tickup | 6 | caretup | \"^\" | triangle_up | \"2\" | tri_up\n", + "3 | tickdown | 7 | caretdown | \"v\" | triangle_down | \"1\" | tri_down\n", + "\"None\" | nothing | `None` | default | \" \" | nothing | \"\" | nothing" ] }, { From 4aa4074aa3c7c376cd9e9b2262012f73edbb0dfb Mon Sep 17 00:00:00 2001 From: Jess Tiu Date: Mon, 21 Oct 2019 22:23:18 +0800 Subject: [PATCH 7/9] Add explanation for imshow usage --- solutions/2.2-vmin_vmax_imshow_and_colorbars.py | 1 + 1 file changed, 1 insertion(+) diff --git a/solutions/2.2-vmin_vmax_imshow_and_colorbars.py b/solutions/2.2-vmin_vmax_imshow_and_colorbars.py index 2bc76a8..0fd5630 100644 --- a/solutions/2.2-vmin_vmax_imshow_and_colorbars.py +++ b/solutions/2.2-vmin_vmax_imshow_and_colorbars.py @@ -15,6 +15,7 @@ # Now you're on your own! for ax, data in zip(axes, [data1, data2, data3]): + # Display data, explicitly making the colormap cover values from 0 to 3 im = ax.imshow(data, vmin=0, vmax=3, interpolation='nearest') fig.colorbar(im, cax=cax, orientation='horizontal') From 21339aabbed1b0f0f5f77e812f48b04bb1d9eada Mon Sep 17 00:00:00 2001 From: Jess Tiu Date: Mon, 21 Oct 2019 22:55:51 +0800 Subject: [PATCH 8/9] Fix alignment --- solutions/2.2-vmin_vmax_imshow_and_colorbars.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solutions/2.2-vmin_vmax_imshow_and_colorbars.py b/solutions/2.2-vmin_vmax_imshow_and_colorbars.py index 0fd5630..208e6ea 100644 --- a/solutions/2.2-vmin_vmax_imshow_and_colorbars.py +++ b/solutions/2.2-vmin_vmax_imshow_and_colorbars.py @@ -15,7 +15,7 @@ # Now you're on your own! for ax, data in zip(axes, [data1, data2, data3]): - # Display data, explicitly making the colormap cover values from 0 to 3 + # Display data, explicitly making the colormap cover values from 0 to 3 im = ax.imshow(data, vmin=0, vmax=3, interpolation='nearest') fig.colorbar(im, cax=cax, orientation='horizontal') From f8bc59ffe1f84b900989de41e685e85a6835ba76 Mon Sep 17 00:00:00 2001 From: Canute <46291012+canute24@users.noreply.github.com> Date: Sat, 7 Aug 2021 10:16:21 +0530 Subject: [PATCH 9/9] Updated with changes as per newer matplotlib api to remove deprecation warning Updated `bar.set(color='salmon', edgecolor='darkred', linewidth=3)` to pass `color` before `edgecolor` to fix `MatplotlibDeprecationWarning` --- AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb b/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb index 8239f9e..ac00986 100644 --- a/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb +++ b/AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb @@ -116,7 +116,7 @@ "# We could have also done this with two separate calls to `ax.bar` and numpy boolean indexing.\n", "for bar, height in zip(vert_bars, y):\n", " if height < 0:\n", - " bar.set(edgecolor='darkred', color='salmon', linewidth=3)\n", + " bar.set(color='salmon', edgecolor='darkred', linewidth=3)\n", "\n", "plt.show()" ] pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy