Skip to content

Commit 68e0be0

Browse files
committed
Update images in section 2
1 parent 32355aa commit 68e0be0

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

notebooks/2-animations.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"We made a bar plot that captured the total number of questions per library, but it couldn't show us the growth in pandas questions over time (or how the growth rate changed over time):\n",
6161
"\n",
6262
"<div style=\"text-align: center;\">\n",
63-
" <img width=\"60%\" src=\"https://raw.githubusercontent.com/stefmolin/python-data-viz-workshop/main/media/bar_plot.svg\" alt=\"bar plot\" style=\"min-width: 500px\">\n",
63+
" <img width=\"60%\" src=\"../slides/media/bar_plot.svg\" alt=\"bar plot\" style=\"min-width: 500px\">\n",
6464
"</div>"
6565
]
6666
},
@@ -77,7 +77,7 @@
7777
"We also made an area plot showing the number of questions per day over time for the top 4 libraries, but by limiting the libraries shown we lost some information:\n",
7878
"\n",
7979
"<div style=\"text-align: center;\">\n",
80-
" <img width=\"90%\" src=\"https://raw.githubusercontent.com/stefmolin/python-data-viz-workshop/main/media/area_plot.svg\" alt=\"area plot\" style=\"min-width: 600px\">\n",
80+
" <img width=\"90%\" src=\"../slides/media/area_plot.svg\" alt=\"area plot\" style=\"min-width: 600px\">\n",
8181
"</div>"
8282
]
8383
},
@@ -373,7 +373,7 @@
373373
" fig, ax = plt.subplots(figsize=(6, 4), layout='constrained')\n",
374374
" sort_order = data.loc[data.index.max()].sort_values().index\n",
375375
" bars = ax.barh(sort_order, [0] * data.shape[1], label=sort_order)\n",
376-
" \n",
376+
"\n",
377377
" ax.set_xlabel('total questions', fontweight='bold')\n",
378378
" ax.set_xlim(0, 250_000)\n",
379379
" ax.xaxis.set_major_formatter(ticker.EngFormatter())\n",
@@ -1797,7 +1797,7 @@
17971797
"source": [
17981798
"def update(frame, *, ax, df, annotations, time_text):\n",
17991799
" data = df.loc[frame, :]\n",
1800-
" \n",
1800+
"\n",
18011801
" # update bars\n",
18021802
" for rect, text in zip(ax.patches, annotations):\n",
18031803
" col = rect.get_label()\n",
@@ -1883,7 +1883,7 @@
18831883
" fig, update_func, frames=questions_per_library.index, repeat=False\n",
18841884
")\n",
18851885
"ani.save(\n",
1886-
" '../media/stackoverflow_questions.mp4', \n",
1886+
" '../media/stackoverflow_questions.mp4',\n",
18871887
" writer='ffmpeg', fps=10, bitrate=100, dpi=300\n",
18881888
")\n",
18891889
"plt.close()"
@@ -1957,7 +1957,7 @@
19571957
"As with the previous example, the histograms of daily Manhattan subway entries in 2018 (from the first section of the workshop) don't tell the whole story of the dataset because the distributions changed drastically in 2020 and 2021:\n",
19581958
"\n",
19591959
"<div style=\"text-align: center;\">\n",
1960-
" <img width=\"70%\" src=\"https://raw.githubusercontent.com/stefmolin/python-data-viz-workshop/main/media/2018_subway_entries_histogram.svg\" alt=\"Histograms of daily Manhattan subway entries in 2018\" style=\"min-width: 500px\">\n",
1960+
" <img width=\"70%\" src=\"../slides/media/2018_subway_entries_histogram.svg\" alt=\"Histograms of daily Manhattan subway entries in 2018\" style=\"min-width: 500px\">\n",
19611961
"</div>"
19621962
]
19631963
},
@@ -2153,7 +2153,7 @@
21532153
],
21542154
"source": [
21552155
"subway = pd.read_csv(\n",
2156-
" '../data/NYC_subway_daily.csv', parse_dates=['Datetime'], \n",
2156+
" '../data/NYC_subway_daily.csv', parse_dates=['Datetime'],\n",
21572157
" index_col=['Borough', 'Datetime']\n",
21582158
")\n",
21592159
"subway_daily = subway.unstack(0)\n",
@@ -2249,7 +2249,7 @@
22492249
" {'label': 'Weekend', 'mask': ~weekday_mask, 'ymax': 60},\n",
22502250
" {'label': 'Weekday', 'mask': weekday_mask, 'ymax': 120}\n",
22512251
" ]\n",
2252-
" \n",
2252+
"\n",
22532253
" fig, axes = plt.subplots(1, 2, figsize=(6, 3), sharex=True, layout='constrained')\n",
22542254
" for ax, config in zip(axes, configs):\n",
22552255
" _, _, config['hist'] = ax.hist(\n",
@@ -4396,7 +4396,7 @@
43964396
"metadata": {},
43974397
"outputs": [],
43984398
"source": [
4399-
"# "
4399+
"#"
44004400
]
44014401
},
44024402
{

slides/2-animations.ipynb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
"We made a bar plot that captured the total number of questions per library, but it couldn't show us the growth in pandas questions over time (or how the growth rate changed over time):\n",
8686
"\n",
8787
"<div style=\"text-align: center;\">\n",
88-
" <img width=\"60%\" src=\"https://raw.githubusercontent.com/stefmolin/python-data-viz-workshop/main/media/bar_plot.svg\" alt=\"bar plot\" style=\"min-width: 500px\">\n",
88+
" <img width=\"60%\" src=\"media/bar_plot.svg\" alt=\"bar plot\" style=\"min-width: 500px\">\n",
8989
"</div>"
9090
]
9191
},
@@ -102,7 +102,7 @@
102102
"We also made an area plot showing the number of questions per day over time for the top 4 libraries, but by limiting the libraries shown we lost some information:\n",
103103
"\n",
104104
"<div style=\"text-align: center;\">\n",
105-
" <img width=\"90%\" src=\"https://raw.githubusercontent.com/stefmolin/python-data-viz-workshop/main/media/area_plot.svg\" alt=\"area plot\" style=\"min-width: 600px\">\n",
105+
" <img width=\"90%\" src=\"media/area_plot.svg\" alt=\"area plot\" style=\"min-width: 600px\">\n",
106106
"</div>"
107107
]
108108
},
@@ -404,7 +404,7 @@
404404
" fig, ax = plt.subplots(figsize=(6, 4), layout='constrained')\n",
405405
" sort_order = data.loc[data.index.max()].squeeze().sort_values().index\n",
406406
" bars = ax.barh(sort_order, [0] * data.shape[1], label=sort_order)\n",
407-
" \n",
407+
"\n",
408408
" ax.set_xlabel('total questions', fontweight='bold')\n",
409409
" ax.set_xlim(0, 250_000)\n",
410410
" ax.xaxis.set_major_formatter(ticker.EngFormatter())\n",
@@ -1834,7 +1834,7 @@
18341834
"source": [
18351835
"def update(frame, *, ax, df, annotations, time_text):\n",
18361836
" data = df.loc[frame, :]\n",
1837-
" \n",
1837+
"\n",
18381838
" # update bars\n",
18391839
" for rect, text in zip(ax.patches, annotations):\n",
18401840
" col = rect.get_label()\n",
@@ -1922,7 +1922,7 @@
19221922
" fig, update_func, frames=questions_per_library.index, repeat=False\n",
19231923
")\n",
19241924
"ani.save(\n",
1925-
" '../media/stackoverflow_questions.mp4', \n",
1925+
" '../media/stackoverflow_questions.mp4',\n",
19261926
" writer='ffmpeg', fps=10, bitrate=100, dpi=300\n",
19271927
")\n",
19281928
"plt.close()"
@@ -2015,7 +2015,7 @@
20152015
"As with the previous example, the histograms of daily Manhattan subway entries in 2018 (from the first section of the workshop) don't tell the whole story of the dataset because the distributions changed drastically in 2020 and 2021:\n",
20162016
"\n",
20172017
"<div style=\"text-align: center;\">\n",
2018-
" <img width=\"70%\" src=\"https://raw.githubusercontent.com/stefmolin/python-data-viz-workshop/main/media/2018_subway_entries_histogram.svg\" alt=\"Histograms of daily Manhattan subway entries in 2018\" style=\"min-width: 500px\">\n",
2018+
" <img width=\"70%\" src=\"media/2018_subway_entries_histogram.svg\" alt=\"Histograms of daily Manhattan subway entries in 2018\" style=\"min-width: 500px\">\n",
20192019
"</div>"
20202020
]
20212021
},
@@ -2213,7 +2213,7 @@
22132213
],
22142214
"source": [
22152215
"subway = pd.read_csv(\n",
2216-
" '../data/NYC_subway_daily.csv', parse_dates=['Datetime'], \n",
2216+
" '../data/NYC_subway_daily.csv', parse_dates=['Datetime'],\n",
22172217
" index_col=['Borough', 'Datetime']\n",
22182218
")\n",
22192219
"subway_daily = subway.unstack(0)\n",
@@ -2315,7 +2315,7 @@
23152315
" {'label': 'Weekend', 'mask': ~weekday_mask, 'ymax': 60},\n",
23162316
" {'label': 'Weekday', 'mask': weekday_mask, 'ymax': 120}\n",
23172317
" ]\n",
2318-
" \n",
2318+
"\n",
23192319
" fig, axes = plt.subplots(1, 2, figsize=(6, 3), sharex=True, layout='constrained')\n",
23202320
" for ax, config in zip(axes, configs):\n",
23212321
" _, _, config['hist'] = ax.hist(\n",
@@ -4461,7 +4461,7 @@
44614461
"import pandas as pd\n",
44624462
"\n",
44634463
"manhattan_entries = pd.read_csv(\n",
4464-
" '../data/NYC_subway_daily.csv', parse_dates=['Datetime'], \n",
4464+
" '../data/NYC_subway_daily.csv', parse_dates=['Datetime'],\n",
44654465
" index_col=['Borough', 'Datetime']\n",
44664466
").unstack(0)['Entries']['M']\n",
44674467
"manhattan_entries.head()"
@@ -4541,7 +4541,7 @@
45414541
"source": [
45424542
"def subway_histogram(data, bins, date_range):\n",
45434543
" _, bin_ranges = np.histogram(data, bins=bins)\n",
4544-
" \n",
4544+
"\n",
45454545
" weekday_mask = data.index.weekday < 5\n",
45464546
" configs = [ # CHANGE: add bar color to config\n",
45474547
" {'label': 'Weekend', 'mask': ~weekday_mask, 'color': 'orange'},\n",
@@ -4557,7 +4557,7 @@
45574557
"\n",
45584558
" ax.xaxis.set_major_formatter(ticker.EngFormatter())\n",
45594559
" despine(ax)\n",
4560-
" \n",
4560+
"\n",
45614561
" # CHANGES: update formatting and add legend\n",
45624562
" ax.set(\n",
45634563
" xlim=(0, None), ylim=(0, 120), xlabel='Entries', ylabel='Frequency',\n",
File renamed without changes.

0 commit comments

Comments
 (0)