Skip to content

Commit 1e6f126

Browse files
committed
added style sheet discussion
1 parent 17b4024 commit 1e6f126

7 files changed

+1903
-1202
lines changed

Part I - Matplotlib.ipynb renamed to 1. Matplotlib.ipynb

+57-43
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,28 @@
5858
"name": "stdout",
5959
"output_type": "stream",
6060
"text": [
61-
"Wed Sep 25 2019 \n",
61+
"watermark 1.8.1\n",
62+
"matplotlib 3.1.0\n",
63+
"numpy 1.16.2\n",
64+
"pandas 0.24.2\n",
65+
"Sun Dec 01 2019 \n",
6266
"\n",
6367
"CPython 3.7.3\n",
6468
"IPython 6.2.1\n",
6569
"\n",
66-
"numpy 1.16.2\n",
67-
"matplotlib 3.1.0\n",
68-
"pandas 0.24.2\n",
69-
"\n",
7070
"compiler : Clang 4.0.1 (tags/RELEASE_401/final)\n",
7171
"system : Darwin\n",
72-
"release : 18.7.0\n",
72+
"release : 19.0.0\n",
7373
"machine : x86_64\n",
7474
"processor : i386\n",
7575
"CPU cores : 8\n",
76-
"interpreter: 64bit\n"
76+
"interpreter: 64bit\n",
77+
"Git hash : 17b4024f04091f8fdc1ee8a8e6705838976550c3\n"
7778
]
7879
}
7980
],
8081
"source": [
81-
"%watermark -n -v -m -p numpy,matplotlib,pandas"
82+
"%watermark -n -v -m -g -iv"
8283
]
8384
},
8485
{
@@ -129,7 +130,7 @@
129130
{
130131
"data": {
131132
"text/plain": [
132-
"[<matplotlib.lines.Line2D at 0x11d7d7ba8>]"
133+
"[<matplotlib.lines.Line2D at 0x11f38b0b8>]"
133134
]
134135
},
135136
"execution_count": 5,
@@ -168,7 +169,7 @@
168169
{
169170
"data": {
170171
"text/plain": [
171-
"[<matplotlib.lines.Line2D at 0x11da92cf8>]"
172+
"[<matplotlib.lines.Line2D at 0x11f64a128>]"
172173
]
173174
},
174175
"execution_count": 6,
@@ -207,7 +208,7 @@
207208
{
208209
"data": {
209210
"text/plain": [
210-
"<matplotlib.legend.Legend at 0x11dae4780>"
211+
"<matplotlib.legend.Legend at 0x11f690438>"
211212
]
212213
},
213214
"execution_count": 7,
@@ -247,7 +248,7 @@
247248
{
248249
"data": {
249250
"text/plain": [
250-
"<matplotlib.legend.Legend at 0x11de03860>"
251+
"<matplotlib.legend.Legend at 0x11f86ec88>"
251252
]
252253
},
253254
"execution_count": 8,
@@ -446,7 +447,7 @@
446447
{
447448
"data": {
448449
"text/plain": [
449-
"<matplotlib.axes._subplots.AxesSubplot at 0x11fea4048>"
450+
"<matplotlib.axes._subplots.AxesSubplot at 0x121a5a828>"
450451
]
451452
},
452453
"execution_count": 13,
@@ -528,7 +529,7 @@
528529
{
529530
"data": {
530531
"text/plain": [
531-
"<matplotlib.legend.Legend at 0x120217d68>"
532+
"<matplotlib.legend.Legend at 0x121dbe390>"
532533
]
533534
},
534535
"execution_count": 15,
@@ -603,7 +604,7 @@
603604
{
604605
"data": {
605606
"text/plain": [
606-
"<matplotlib.legend.Legend at 0x11da226d8>"
607+
"<matplotlib.legend.Legend at 0x1220e4860>"
607608
]
608609
},
609610
"execution_count": 17,
@@ -660,7 +661,7 @@
660661
{
661662
"data": {
662663
"text/plain": [
663-
"<matplotlib.legend.Legend at 0x12085fc50>"
664+
"<matplotlib.legend.Legend at 0x122416128>"
664665
]
665666
},
666667
"execution_count": 18,
@@ -717,21 +718,37 @@
717718
"cell_type": "markdown",
718719
"metadata": {},
719720
"source": [
720-
"We'll plot these three datasets using both bar and pie plots. "
721+
"We'll plot these three datasets using both bar and pie plots. As we want to make sure we use the same colors for the corresponding bar/slice, we start by explicitly obtaining the color cycle"
721722
]
722723
},
723724
{
724725
"cell_type": "code",
725726
"execution_count": 20,
726727
"metadata": {},
728+
"outputs": [],
729+
"source": [
730+
"colors = plt.rcParams['axes.prop_cycle'].by_key()['color']"
731+
]
732+
},
733+
{
734+
"cell_type": "markdown",
735+
"metadata": {},
736+
"source": [
737+
"Now we can supply the right color sequence to use for the bars"
738+
]
739+
},
740+
{
741+
"cell_type": "code",
742+
"execution_count": 21,
743+
"metadata": {},
727744
"outputs": [
728745
{
729746
"data": {
730747
"text/plain": [
731748
"(0, 25)"
732749
]
733750
},
734-
"execution_count": 20,
751+
"execution_count": 21,
735752
"metadata": {},
736753
"output_type": "execute_result"
737754
},
@@ -749,9 +766,6 @@
749766
}
750767
],
751768
"source": [
752-
"prop_cycle = plt.rcParams['axes.prop_cycle']\n",
753-
"colors = prop_cycle.by_key()['color']\n",
754-
"\n",
755769
"fig, axs = plt.subplots(nrows=2, ncols=3)\n",
756770
"fig.set_size_inches(14,10)\n",
757771
"\n",
@@ -785,7 +799,7 @@
785799
},
786800
{
787801
"cell_type": "code",
788-
"execution_count": 21,
802+
"execution_count": 22,
789803
"metadata": {},
790804
"outputs": [
791805
{
@@ -794,7 +808,7 @@
794808
"<BarContainer object of 1 artists>"
795809
]
796810
},
797-
"execution_count": 21,
811+
"execution_count": 22,
798812
"metadata": {},
799813
"output_type": "execute_result"
800814
},
@@ -835,7 +849,7 @@
835849
},
836850
{
837851
"cell_type": "code",
838-
"execution_count": 22,
852+
"execution_count": 23,
839853
"metadata": {},
840854
"outputs": [
841855
{
@@ -893,7 +907,7 @@
893907
},
894908
{
895909
"cell_type": "code",
896-
"execution_count": 23,
910+
"execution_count": 24,
897911
"metadata": {},
898912
"outputs": [],
899913
"source": [
@@ -909,7 +923,7 @@
909923
},
910924
{
911925
"cell_type": "code",
912-
"execution_count": 24,
926+
"execution_count": 25,
913927
"metadata": {},
914928
"outputs": [],
915929
"source": [
@@ -937,7 +951,7 @@
937951
},
938952
{
939953
"cell_type": "code",
940-
"execution_count": 25,
954+
"execution_count": 26,
941955
"metadata": {},
942956
"outputs": [
943957
{
@@ -1022,7 +1036,7 @@
10221036
"4 Burkina Faso 1217.032994 14326203 52.295 0"
10231037
]
10241038
},
1025-
"execution_count": 25,
1039+
"execution_count": 26,
10261040
"metadata": {},
10271041
"output_type": "execute_result"
10281042
}
@@ -1047,7 +1061,7 @@
10471061
},
10481062
{
10491063
"cell_type": "code",
1050-
"execution_count": 26,
1064+
"execution_count": 27,
10511065
"metadata": {},
10521066
"outputs": [
10531067
{
@@ -1109,7 +1123,7 @@
11091123
},
11101124
{
11111125
"cell_type": "code",
1112-
"execution_count": 27,
1126+
"execution_count": 28,
11131127
"metadata": {},
11141128
"outputs": [],
11151129
"source": [
@@ -1125,7 +1139,7 @@
11251139
},
11261140
{
11271141
"cell_type": "code",
1128-
"execution_count": 28,
1142+
"execution_count": 29,
11291143
"metadata": {},
11301144
"outputs": [
11311145
{
@@ -1210,7 +1224,7 @@
12101224
"4 40 - 50 28289 45107 -45107 4"
12111225
]
12121226
},
1213-
"execution_count": 28,
1227+
"execution_count": 29,
12141228
"metadata": {},
12151229
"output_type": "execute_result"
12161230
}
@@ -1221,7 +1235,7 @@
12211235
},
12221236
{
12231237
"cell_type": "code",
1224-
"execution_count": 29,
1238+
"execution_count": 30,
12251239
"metadata": {},
12261240
"outputs": [
12271241
{
@@ -1278,7 +1292,7 @@
12781292
},
12791293
{
12801294
"cell_type": "code",
1281-
"execution_count": 30,
1295+
"execution_count": 31,
12821296
"metadata": {},
12831297
"outputs": [],
12841298
"source": [
@@ -1294,16 +1308,16 @@
12941308
},
12951309
{
12961310
"cell_type": "code",
1297-
"execution_count": 31,
1311+
"execution_count": 32,
12981312
"metadata": {},
12991313
"outputs": [
13001314
{
13011315
"data": {
13021316
"text/plain": [
1303-
"<matplotlib.image.AxesImage at 0x10b4cd668>"
1317+
"<matplotlib.image.AxesImage at 0x123637c18>"
13041318
]
13051319
},
1306-
"execution_count": 31,
1320+
"execution_count": 32,
13071321
"metadata": {},
13081322
"output_type": "execute_result"
13091323
},
@@ -1333,7 +1347,7 @@
13331347
},
13341348
{
13351349
"cell_type": "code",
1336-
"execution_count": 32,
1350+
"execution_count": 33,
13371351
"metadata": {},
13381352
"outputs": [
13391353
{
@@ -1357,7 +1371,7 @@
13571371
},
13581372
{
13591373
"cell_type": "code",
1360-
"execution_count": 33,
1374+
"execution_count": 34,
13611375
"metadata": {},
13621376
"outputs": [
13631377
{
@@ -1401,7 +1415,7 @@
14011415
},
14021416
{
14031417
"cell_type": "code",
1404-
"execution_count": 34,
1418+
"execution_count": 35,
14051419
"metadata": {},
14061420
"outputs": [
14071421
{
@@ -1428,7 +1442,7 @@
14281442
},
14291443
{
14301444
"cell_type": "code",
1431-
"execution_count": 35,
1445+
"execution_count": 36,
14321446
"metadata": {},
14331447
"outputs": [
14341448
{
@@ -1459,7 +1473,7 @@
14591473
},
14601474
{
14611475
"cell_type": "code",
1462-
"execution_count": 36,
1476+
"execution_count": 37,
14631477
"metadata": {},
14641478
"outputs": [],
14651479
"source": [
@@ -1511,7 +1525,7 @@
15111525
},
15121526
{
15131527
"cell_type": "code",
1514-
"execution_count": 37,
1528+
"execution_count": 38,
15151529
"metadata": {},
15161530
"outputs": [
15171531
{

0 commit comments

Comments
 (0)