Apple's 2021 Q4 Results with Plotapi Sankey
Preamble¶
from plotapi import Sankey
Sankey.set_license("your username", "your license key")
Introduction¶
In this notebook we're going to use Plotapi Sankey to visualise some of the Apple's filings for the fourth quarter of 2021.
Dataset¶
The data can be found in the consolidated financial statements for the three months ending on September 25th 2021.
links = [
{"source":"iPhone", "target":"Total Revenue", "value": 38.868},
{"source":"Mac", "target":"Total Revenue", "value": 9.178},
{"source":"iPad", "target":"Total Revenue", "value": 8.252},
{"source":"Wearables & Accessories", "target":"Total Revenue", "value": 8.785},
{"source":"Services", "target":"Total Revenue", "value": 18.277},
{"source":"Total Revenue", "target":"Cost of Products", "value": 42.790},
{"source":"Total Revenue", "target":"Products Gross Profit", "value": 22.293},
{"source":"Total Revenue", "target":"Cost of Services", "value": 5.396},
{"source":"Total Revenue", "target":"Services Gross Profit", "value": 12.881},
]
Visualisation¶
Let's use Plotapi Sankey for this visualisation, you can see more examples in the Gallery.
We're going to adjust some colors, layout/template parameters, and flip the intro animation on too.
colors = ["#61bb46", "#fdb827", "#f5821f", "#e03a3e", "#963d97", "#009ddc",
"red", "lightgreen", "red", "lightgreen",]
Sankey(links, colors=colors, animated_intro=True,
link_verb="$", node_verb="$", noun="billion",
link_numbers_template="$<plotapi_value>bn").show()