Skip to content

Commit fb0d77f

Browse files
vahid-ahmadiclaude
andauthored
Fix carbon intensity chart in docs (#580) (#1648)
The chart in docs/book/programs/contrib/ubi-center/carbon-tax.ipynb is now a horizontal bar chart (axes flipped), with the "Category" axis label removed and the value axis relabelled to "Tonnes CO2 per £1,000". The previous chart scaled intensity by 100 and had a nonsensical "pence/tonne" tick suffix. Notebook outputs re-executed so the built jupyter-book renders the new chart (execute_notebooks is off). Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e0e3dbe commit fb0d77f

2 files changed

Lines changed: 70 additions & 118 deletions

File tree

changelog.d/580.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Replace the carbon intensity chart in the carbon tax doc with a horizontal bar ranking categories, with the axis relabelled to tonnes CO2 per £1,000 (the previous chart had a nonsensical "pence/tonne" tick suffix).

docs/book/programs/contrib/ubi-center/carbon-tax.ipynb

Lines changed: 69 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@
6161
"execution_count": 1,
6262
"id": "8b7f5e74-3376-42f7-8f91-44ba40e54ea4",
6363
"metadata": {
64+
"execution": {
65+
"iopub.execute_input": "2026-04-24T12:13:00.455657Z",
66+
"iopub.status.busy": "2026-04-24T12:13:00.455392Z",
67+
"iopub.status.idle": "2026-04-24T12:13:01.472975Z",
68+
"shell.execute_reply": "2026-04-24T12:13:01.472688Z"
69+
},
6470
"tags": [
6571
"hide-input"
6672
]
@@ -74,8 +80,7 @@
7480
},
7581
"data": [
7682
{
77-
"alignmentgroup": "True",
78-
"hovertemplate": "Category=%{x}<br>Intensity*100=%{y}<extra></extra>",
83+
"hovertemplate": "Tonnes CO2 per £1,000=%{x}<br>Category=%{y}<extra></extra>",
7984
"legendgroup": "",
8085
"marker": {
8186
"color": "#636efa",
@@ -84,39 +89,28 @@
8489
}
8590
},
8691
"name": "",
87-
"offsetgroup": "",
88-
"orientation": "v",
92+
"orientation": "h",
8993
"showlegend": false,
9094
"textposition": "auto",
9195
"type": "bar",
92-
"x": [
93-
"Housing, water and electricity",
94-
"Transport",
95-
"Food",
96-
"Health",
97-
"Communication",
98-
"Restaurants and hotels",
99-
"Clothing and footwear",
100-
"Education",
101-
"Household furnishings",
102-
"Miscellaneous",
103-
"Recreation",
104-
"Alcohol and tobacco"
105-
],
96+
"x": {
97+
"bdata": "g8DKoUW2sz+uR+F6FK7HP5ZDi2zn+8k/iUFg5dAiyz8MAiuHFtnOP/hT46WbxNA/gZVDi2zn0z9CYOXQItvZP8uhRbbz/eQ/QDVeukkM5j8fhetRuB7xPzMzMzMzM/M/",
98+
"dtype": "f8"
99+
},
106100
"xaxis": "x",
107101
"y": [
108-
0.12,
109-
0.107,
110-
0.0689,
111-
0.0656,
112-
0.0404,
113-
0.031100000000000003,
114-
0.0262,
115-
0.0241,
116-
0.0212,
117-
0.0203,
118-
0.0185,
119-
0.0077
102+
"Alcohol and tobacco",
103+
"Recreation",
104+
"Miscellaneous",
105+
"Household furnishings",
106+
"Education",
107+
"Clothing and footwear",
108+
"Restaurants and hotels",
109+
"Communication",
110+
"Health",
111+
"Food",
112+
"Transport",
113+
"Housing, water and electricity"
120114
],
121115
"yaxis": "y"
122116
}
@@ -206,7 +200,7 @@
206200
},
207201
"colorscale": [
208202
[
209-
0,
203+
0.0,
210204
"#0d0887"
211205
],
212206
[
@@ -242,7 +236,7 @@
242236
"#fdca26"
243237
],
244238
[
245-
1,
239+
1.0,
246240
"#f0f921"
247241
]
248242
],
@@ -266,7 +260,7 @@
266260
},
267261
"colorscale": [
268262
[
269-
0,
263+
0.0,
270264
"#0d0887"
271265
],
272266
[
@@ -302,64 +296,13 @@
302296
"#fdca26"
303297
],
304298
[
305-
1,
299+
1.0,
306300
"#f0f921"
307301
]
308302
],
309303
"type": "heatmap"
310304
}
311305
],
312-
"heatmapgl": [
313-
{
314-
"colorbar": {
315-
"outlinewidth": 0,
316-
"ticks": ""
317-
},
318-
"colorscale": [
319-
[
320-
0,
321-
"#0d0887"
322-
],
323-
[
324-
0.1111111111111111,
325-
"#46039f"
326-
],
327-
[
328-
0.2222222222222222,
329-
"#7201a8"
330-
],
331-
[
332-
0.3333333333333333,
333-
"#9c179e"
334-
],
335-
[
336-
0.4444444444444444,
337-
"#bd3786"
338-
],
339-
[
340-
0.5555555555555556,
341-
"#d8576b"
342-
],
343-
[
344-
0.6666666666666666,
345-
"#ed7953"
346-
],
347-
[
348-
0.7777777777777778,
349-
"#fb9f3a"
350-
],
351-
[
352-
0.8888888888888888,
353-
"#fdca26"
354-
],
355-
[
356-
1,
357-
"#f0f921"
358-
]
359-
],
360-
"type": "heatmapgl"
361-
}
362-
],
363306
"histogram": [
364307
{
365308
"marker": {
@@ -380,7 +323,7 @@
380323
},
381324
"colorscale": [
382325
[
383-
0,
326+
0.0,
384327
"#0d0887"
385328
],
386329
[
@@ -416,7 +359,7 @@
416359
"#fdca26"
417360
],
418361
[
419-
1,
362+
1.0,
420363
"#f0f921"
421364
]
422365
],
@@ -431,7 +374,7 @@
431374
},
432375
"colorscale": [
433376
[
434-
0,
377+
0.0,
435378
"#0d0887"
436379
],
437380
[
@@ -467,7 +410,7 @@
467410
"#fdca26"
468411
],
469412
[
470-
1,
413+
1.0,
471414
"#f0f921"
472415
]
473416
],
@@ -502,11 +445,10 @@
502445
],
503446
"scatter": [
504447
{
505-
"marker": {
506-
"colorbar": {
507-
"outlinewidth": 0,
508-
"ticks": ""
509-
}
448+
"fillpattern": {
449+
"fillmode": "overlay",
450+
"size": 10,
451+
"solidity": 0.2
510452
},
511453
"type": "scatter"
512454
}
@@ -561,6 +503,17 @@
561503
"type": "scattergl"
562504
}
563505
],
506+
"scattermap": [
507+
{
508+
"marker": {
509+
"colorbar": {
510+
"outlinewidth": 0,
511+
"ticks": ""
512+
}
513+
},
514+
"type": "scattermap"
515+
}
516+
],
564517
"scattermapbox": [
565518
{
566519
"marker": {
@@ -613,7 +566,7 @@
613566
},
614567
"colorscale": [
615568
[
616-
0,
569+
0.0,
617570
"#0d0887"
618571
],
619572
[
@@ -649,7 +602,7 @@
649602
"#fdca26"
650603
],
651604
[
652-
1,
605+
1.0,
653606
"#f0f921"
654607
]
655608
],
@@ -740,7 +693,7 @@
740693
],
741694
"sequential": [
742695
[
743-
0,
696+
0.0,
744697
"#0d0887"
745698
],
746699
[
@@ -776,13 +729,13 @@
776729
"#fdca26"
777730
],
778731
[
779-
1,
732+
1.0,
780733
"#f0f921"
781734
]
782735
],
783736
"sequentialminus": [
784737
[
785-
0,
738+
0.0,
786739
"#0d0887"
787740
],
788741
[
@@ -818,7 +771,7 @@
818771
"#fdca26"
819772
],
820773
[
821-
1,
774+
1.0,
822775
"#f0f921"
823776
]
824777
]
@@ -948,29 +901,26 @@
948901
}
949902
},
950903
"title": {
951-
"text": "Tonnes of CO2 per pound by category"
904+
"text": "Carbon intensity by consumption category"
952905
},
953906
"width": 800,
954907
"xaxis": {
955908
"anchor": "y",
956909
"domain": [
957-
0,
958-
1
910+
0.0,
911+
1.0
959912
],
960913
"title": {
961-
"text": "Category"
914+
"text": "Tonnes CO2 per £1,000"
962915
}
963916
},
964917
"yaxis": {
965918
"anchor": "x",
966919
"domain": [
967-
0,
968-
1
920+
0.0,
921+
1.0
969922
],
970-
"ticksuffix": " pence/tonne",
971-
"title": {
972-
"text": "Intensity*100"
973-
}
923+
"title": {}
974924
}
975925
}
976926
}
@@ -1016,18 +966,19 @@
1016966
" }\n",
1017967
")\n",
1018968
"\n",
1019-
"df[\"Intensity*100\"] = df.Intensity * 100\n",
969+
"df[\"Tonnes CO2 per £1,000\"] = df.Intensity * 1000\n",
1020970
"\n",
1021971
"px.bar(\n",
1022-
" df.sort_values(\"Intensity\", ascending=False),\n",
1023-
" x=\"Category\",\n",
1024-
" y=\"Intensity*100\",\n",
972+
" df.sort_values(\"Tonnes CO2 per £1,000\", ascending=True),\n",
973+
" x=\"Tonnes CO2 per £1,000\",\n",
974+
" y=\"Category\",\n",
975+
" orientation=\"h\",\n",
1025976
").update_layout(\n",
1026-
" title=\"Tonnes of CO2 per pound by category\",\n",
1027-
" yaxis_ticksuffix=\" pence/tonne\",\n",
977+
" title=\"Carbon intensity by consumption category\",\n",
978+
" yaxis_title=None,\n",
1028979
" width=800,\n",
1029980
" height=600,\n",
1030-
")"
981+
")\n"
1031982
]
1032983
}
1033984
],
@@ -1047,7 +998,7 @@
1047998
"name": "python",
1048999
"nbconvert_exporter": "python",
10491000
"pygments_lexer": "ipython3",
1050-
"version": "3.9.12"
1001+
"version": "3.10.13"
10511002
},
10521003
"vscode": {
10531004
"interpreter": {

0 commit comments

Comments
 (0)