Python RandomCharts Visualisations

Tim Cook the most successful CEO

A weekly series of quick random charts made in Python ๐Ÿ

The chart of this week is a classic line chart from the article The great successor’s second act. Apple has had a succesful decade. The next one looks tougher by The Economist.

Tim Cook – the most successful CEO

No chief executive in history has created as much overall shareholder value as Tim Cook. His numbers beat the value generated by Jeff Bezos, who retired as Amazonโ€™s chief executive in July, over his 24 years in charge. They also surpass the achievement of Warren Buffett, who has been running Berkshire Hathaway for nearly 45 years.

Increase in market capitalisation $bn.
Sources: Refinitiv, company reports, press reports, and The Economist.

When Mr Cook took over from Jobs the company had a market value of \$349bn. Today it is worth \$2.5trn , more than any other listed firm ever.

Random chart of the week by @QuantGirl.
import datetime as dt

import matplotlib.dates as mdates
import matplotlib.pyplot as plt
import pandas as pd
import yfinance as yf

data = pd.DataFrame({
    'CEO/chairman': ['Tim Cook', 'Satya Nadella', 'Jeff Bezos', 'Sundar Pichai', 'Mark Zuckerberg', 'Elon Musk',
                     'Warren Buffet', 'Pony Ma', 'Jack Ma'],
    'Company': ['Apple', 'MIcrosoft', 'Amazon', 'Google/Alphabet', 'Facebook', 'Tesla', 'Berkshire Hathaway', 'Tencent',
    'Tenure, years': [10, 7.6, 24.1, 6.0, 9.3, 11.2, 44.9, 17.2, 5.0],
    'During Tenure': [2125, 1973, 1770, 1448, 949.3, 699.2, 647.5, 580.9, 224.2],
    'Per Year': [212.4, 261.2, 73.3, 239.7, 102.4, 62.7, 14.4, 33.8, 45.1]}

ticker = yf.Ticker('AAPL')
apple = ticker.history(start='2011-01-01', end='2021-08-01', interval='1wk')
apple_stock = apple.dropna(subset=['Close'])['Close']

annotations = {
    '2011-08-24': ['Tim Cook becomes CEO', 2.5, 'left'],
    '2011-10-01': ['Siri introduced\non the iPhone', 2, 'left'],
    '2011-10-05': ['Steve Jobs\ndies', 1.5, 'left'],
    '2012-11-02': ['iPad mini\nintroduced', 1, 'left'],
    '2015-04-24': ['First Apple\nwatch unveiled', 1.5, 'right'],
    '2015-06-30': ['Apple Music\nunveiled', 2, 'right'],
    '2016-12-19': ['First Airpods\nunveiled', 1, 'right'],
    '2017-11-03': ['iPhone X with facial\nrecognition unveiled', 1.5, 'right'],
    '2018-02-09': ['First HomePod released', 1.75, 'right'],
    '2018-08-02': ['Apple becomes first listed\nAmerican company\nwith more than $1trn', 2.25, 'right'],
    '2019-11-01': ['Apple TV+\nlaunches', 2, 'right'],
    '2020-04-10': ['Apple and Google team up to enable covid-19 tracing apps', 2.7, 'right'],
    '2021-04-26': ['iPhone app tracking trasparency introduced', 2.9, 'right'],

colors = ['#008bbc', '#3e647d', '#1a476f', '#EFF5F5']

fig, ax = plt.subplots(figsize=(18, 7.5), frameon=True, facecolor=colors[3])

plt.text(x=0.13, y=0.85, s="Quite the orchard", fontsize=20, fontweight="bold", ha="left", transform=fig.transFigure)
plt.text(x=0.13, y=0.81, s="Apple, market capitalisation, $trn", fontsize=16, ha="left", transform=fig.transFigure)

outstanding_shares = 16782
plt.plot(apple_stock * (outstanding_shares / 1000000), ls='-', color=colors[0], linewidth=3)



ax.set_ylim([0, 3.5])
ax.set_yticks([0.5, 1.0, 1.5, 2.0, 2.5])
ax.tick_params(axis="both", bottom="off", top="off", left="off", right="off")
ax.tick_params(axis="y", direction="in", length=20, color=colors[2], pad=-40, labelsize=12)

ax.tick_params(direction='out', axis='x', length=12, pad=10, labelsize=12)
for tick in ax.xaxis.get_major_ticks():

locator = mdates.AutoDateLocator(minticks=3, maxticks=4)
formatter = mdates.ConciseDateFormatter(locator)

for k, v in annotations.items():
    xpos = dt.datetime.strptime(k, '%Y-%m-%d')
    text = v[0]
    ypos = v[1]
    ha = v[2]
    ax.text(xpos, ypos, text, horizontalalignment=ha, fontsize=12, color=colors[2])
    ax.annotate('', xy=(xpos, 0), xytext=(xpos, ypos - 0.05), color='b',
                arrowprops=dict(arrowstyle='-', edgecolor=colors[0], ls='solid', relpos=(0, 0)), fontsize=10)
    ax.plot(xpos, ypos - 0.05, marker="o", color=colors[0])

plt.text(x=0.13, y=-0.05, s="Sources: Refinitiv Datastrean; The Economist", fontsize=14, ha="left",
plt.text(x=0.9, y=-0.05, s="@QuantGirl", ha="right", transform=fig.transFigure, fontdict={'fontsize': 14,
                                                                                          'fontweight': 'bold',
                                                                                          'family': 'sans-serif',
                                                                                          'fontname': 'American Typewriter',
                                                                                          'color': 'purple'})

plt.subplots_adjust(top=0.9, bottom=0.10, wspace=0.1, hspace=0.1)