Skip to content

Commit c96a925

Browse files
committed
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
1 parent 6f0be51 commit c96a925

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

AnatomyOfMatplotlib-Part2-Plotting_Methods_Overview.ipynb

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,38 @@
269269
"# Now you're on your own!\n"
270270
]
271271
},
272+
{
273+
"cell_type": "code",
274+
"execution_count": null,
275+
"metadata": {},
276+
"outputs": [],
277+
"source": [
278+
"import numpy as np\n",
279+
"import matplotlib.pyplot as plt\n",
280+
"np.random.seed(1)\n",
281+
"\n",
282+
"# Generate data...\n",
283+
"y_raw = np.random.randn(1000).cumsum() + 15\n",
284+
"x_raw = np.linspace(0, 24, y_raw.size)\n",
285+
"\n",
286+
"# Get averages of every 100 samples...\n",
287+
"x_pos = x_raw.reshape(-1, 100).min(axis=1)\n",
288+
"y_avg = y_raw.reshape(-1, 100).mean(axis=1)\n",
289+
"y_err = y_raw.reshape(-1, 100).ptp(axis=1)\n",
290+
"\n",
291+
"bar_width = x_pos[1] - x_pos[0]\n",
292+
"\n",
293+
"# Make a made up future prediction with a fake confidence\n",
294+
"x_pred = np.linspace(0, 30)\n",
295+
"y_max_pred = y_avg[0] + y_err[0] + 2.3 * x_pred\n",
296+
"y_min_pred = y_avg[0] - y_err[0] + 1.2 * x_pred\n",
297+
"\n",
298+
"# Just so you don't have to guess at the colors...\n",
299+
"barcolor, linecolor, fillcolor = 'wheat', 'salmon', 'lightblue'\n",
300+
"\n",
301+
"# Now you're on your own!\n"
302+
]
303+
},
272304
{
273305
"cell_type": "markdown",
274306
"metadata": {},
@@ -305,7 +337,7 @@
305337
"outputs": [],
306338
"source": [
307339
"from matplotlib.cbook import get_sample_data\n",
308-
"data = np.load(get_sample_data('axes_grid/bivariate_normal.npy'))\n",
340+
"data = np.load('assets/bivariate_normal.npy')\n",
309341
"\n",
310342
"fig, ax = plt.subplots()\n",
311343
"im = ax.imshow(data, cmap='gist_earth')\n",
@@ -370,7 +402,7 @@
370402
"outputs": [],
371403
"source": [
372404
"from matplotlib.cbook import get_sample_data\n",
373-
"data = np.load(get_sample_data('axes_grid/bivariate_normal.npy'))\n",
405+
"data = np.load('assets/bivariate_normal.npy')\n",
374406
"\n",
375407
"fig, ax = plt.subplots()\n",
376408
"im = ax.imshow(data, cmap='seismic')\n",
@@ -462,7 +494,7 @@
462494
"name": "python",
463495
"nbconvert_exporter": "python",
464496
"pygments_lexer": "ipython3",
465-
"version": "3.6.5"
497+
"version": "3.6.6"
466498
}
467499
},
468500
"nbformat": 4,

assets/bivariate_normal.npy

1.84 KB
Binary file not shown.

0 commit comments

Comments
 (0)
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