|
269 | 269 | "# Now you're on your own!\n" |
270 | 270 | ] |
271 | 271 | }, |
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 | | - }, |
304 | 272 | { |
305 | 273 | "cell_type": "markdown", |
306 | 274 | "metadata": {}, |
|
0 commit comments