Skip to content

Commit d7959e4

Browse files
committed
Update the slope graph example
1 parent db6b2de commit d7959e4

2 files changed

Lines changed: 40 additions & 48 deletions

File tree

examples/.ipynb_checkpoints/6. Slope graphs-checkpoint.ipynb

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,22 @@
177177
"3. We draw the slopes."
178178
]
179179
},
180+
{
181+
"cell_type": "code",
182+
"execution_count": 3,
183+
"metadata": {},
184+
"outputs": [],
185+
"source": [
186+
"# import the Drawable class and set the style\n",
187+
"from multiplex import drawable\n",
188+
"drawable = importlib.reload(drawable)\n",
189+
"plt.style.use(os.path.join(sys.path[0], '..', 'styles', \"modern.style\"))\n",
190+
"\n",
191+
"# create a general style\n",
192+
"style = { 'color': '#AAAAAA', 'linewidth': 5,\n",
193+
" 'marker': 'o', 'markersize': 12 }"
194+
]
195+
},
180196
{
181197
"cell_type": "markdown",
182198
"metadata": {},
@@ -201,7 +217,7 @@
201217
},
202218
{
203219
"cell_type": "code",
204-
"execution_count": 3,
220+
"execution_count": 4,
205221
"metadata": {},
206222
"outputs": [
207223
{
@@ -216,15 +232,6 @@
216232
}
217233
],
218234
"source": [
219-
"# import the Drawable class and set the style\n",
220-
"from multiplex import drawable\n",
221-
"drawable = importlib.reload(drawable)\n",
222-
"plt.style.use(os.path.join(sys.path[0], '..', 'styles', \"modern.style\"))\n",
223-
"\n",
224-
"# create a general style\n",
225-
"style = { 'color': '#AAAAAA', 'linewidth': 5,\n",
226-
" 'marker': 'o', 'markersize': 12 }\n",
227-
"\n",
228235
"# draw the visualization\n",
229236
"figure = plt.figure(figsize=(6, 7))\n",
230237
"viz = drawable.Drawable(figure)\n",
@@ -262,7 +269,7 @@
262269
},
263270
{
264271
"cell_type": "code",
265-
"execution_count": 4,
272+
"execution_count": 5,
266273
"metadata": {},
267274
"outputs": [
268275
{
@@ -277,9 +284,6 @@
277284
}
278285
],
279286
"source": [
280-
"# set the style\n",
281-
"plt.style.use(os.path.join(sys.path[0], '..', 'styles', \"modern.style\"))\n",
282-
"\n",
283287
"# draw a tick for only even-number energy sources\n",
284288
"left_ticks = [ f\"{ int(value) } GWh\" if not i % 2 else '' for i, value in enumerate(df['1998']) ]\n",
285289
"right_ticks = [ f\"{ int(value) } GWh\" if not i % 2 else '' for i, value in enumerate(df['2018']) ]\n",
@@ -336,7 +340,7 @@
336340
},
337341
{
338342
"cell_type": "code",
339-
"execution_count": 5,
343+
"execution_count": 6,
340344
"metadata": {},
341345
"outputs": [
342346
{
@@ -351,10 +355,6 @@
351355
}
352356
],
353357
"source": [
354-
"# set the style\n",
355-
"from multiplex import drawable\n",
356-
"plt.style.use(os.path.join(sys.path[0], '..', 'styles', \"modern.style\"))\n",
357-
"\n",
358358
"# create a custom style for labels\n",
359359
"label_style = { 'fontsize': 'small', 'alpha': 0.8 }\n",
360360
"\n",
@@ -387,7 +387,7 @@
387387
},
388388
{
389389
"cell_type": "code",
390-
"execution_count": 6,
390+
"execution_count": 7,
391391
"metadata": {},
392392
"outputs": [
393393
{
@@ -402,10 +402,6 @@
402402
}
403403
],
404404
"source": [
405-
"# set the style\n",
406-
"from multiplex import drawable\n",
407-
"plt.style.use(os.path.join(sys.path[0], '..', 'styles', \"modern.style\"))\n",
408-
"\n",
409405
"# create a custom style for highlighted slopes\n",
410406
"positive, negative = [ 'Wind', 'Natural gas' ], [ 'Coal', 'Oil' ]\n",
411407
"positive_style, negative_style = dict(style), dict(style)\n",

examples/6. Slope graphs.ipynb

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,22 @@
177177
"3. We draw the slopes."
178178
]
179179
},
180+
{
181+
"cell_type": "code",
182+
"execution_count": 3,
183+
"metadata": {},
184+
"outputs": [],
185+
"source": [
186+
"# import the Drawable class and set the style\n",
187+
"from multiplex import drawable\n",
188+
"drawable = importlib.reload(drawable)\n",
189+
"plt.style.use(os.path.join(sys.path[0], '..', 'styles', \"modern.style\"))\n",
190+
"\n",
191+
"# create a general style\n",
192+
"style = { 'color': '#AAAAAA', 'linewidth': 5,\n",
193+
" 'marker': 'o', 'markersize': 12 }"
194+
]
195+
},
180196
{
181197
"cell_type": "markdown",
182198
"metadata": {},
@@ -201,7 +217,7 @@
201217
},
202218
{
203219
"cell_type": "code",
204-
"execution_count": 3,
220+
"execution_count": 4,
205221
"metadata": {},
206222
"outputs": [
207223
{
@@ -216,15 +232,6 @@
216232
}
217233
],
218234
"source": [
219-
"# import the Drawable class and set the style\n",
220-
"from multiplex import drawable\n",
221-
"drawable = importlib.reload(drawable)\n",
222-
"plt.style.use(os.path.join(sys.path[0], '..', 'styles', \"modern.style\"))\n",
223-
"\n",
224-
"# create a general style\n",
225-
"style = { 'color': '#AAAAAA', 'linewidth': 5,\n",
226-
" 'marker': 'o', 'markersize': 12 }\n",
227-
"\n",
228235
"# draw the visualization\n",
229236
"figure = plt.figure(figsize=(6, 7))\n",
230237
"viz = drawable.Drawable(figure)\n",
@@ -262,7 +269,7 @@
262269
},
263270
{
264271
"cell_type": "code",
265-
"execution_count": 4,
272+
"execution_count": 5,
266273
"metadata": {},
267274
"outputs": [
268275
{
@@ -277,9 +284,6 @@
277284
}
278285
],
279286
"source": [
280-
"# set the style\n",
281-
"plt.style.use(os.path.join(sys.path[0], '..', 'styles', \"modern.style\"))\n",
282-
"\n",
283287
"# draw a tick for only even-number energy sources\n",
284288
"left_ticks = [ f\"{ int(value) } GWh\" if not i % 2 else '' for i, value in enumerate(df['1998']) ]\n",
285289
"right_ticks = [ f\"{ int(value) } GWh\" if not i % 2 else '' for i, value in enumerate(df['2018']) ]\n",
@@ -336,7 +340,7 @@
336340
},
337341
{
338342
"cell_type": "code",
339-
"execution_count": 5,
343+
"execution_count": 6,
340344
"metadata": {},
341345
"outputs": [
342346
{
@@ -351,10 +355,6 @@
351355
}
352356
],
353357
"source": [
354-
"# set the style\n",
355-
"from multiplex import drawable\n",
356-
"plt.style.use(os.path.join(sys.path[0], '..', 'styles', \"modern.style\"))\n",
357-
"\n",
358358
"# create a custom style for labels\n",
359359
"label_style = { 'fontsize': 'small', 'alpha': 0.8 }\n",
360360
"\n",
@@ -387,7 +387,7 @@
387387
},
388388
{
389389
"cell_type": "code",
390-
"execution_count": 6,
390+
"execution_count": 7,
391391
"metadata": {},
392392
"outputs": [
393393
{
@@ -402,10 +402,6 @@
402402
}
403403
],
404404
"source": [
405-
"# set the style\n",
406-
"from multiplex import drawable\n",
407-
"plt.style.use(os.path.join(sys.path[0], '..', 'styles', \"modern.style\"))\n",
408-
"\n",
409405
"# create a custom style for highlighted slopes\n",
410406
"positive, negative = [ 'Wind', 'Natural gas' ], [ 'Coal', 'Oil' ]\n",
411407
"positive_style, negative_style = dict(style), dict(style)\n",

0 commit comments

Comments
 (0)