From c96a9255ef1479d1b8263d30aecefdab4f9b97ab Mon Sep 17 00:00:00 2001 From: ggodreau Date: Sat, 27 Oct 2018 19:00:33 -0500 Subject: [PATCH 1/2] 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 2/2] 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": {},