Skip to content

Instantly share code, notes, and snippets.

@ccerv1
Created February 16, 2019 12:22
Show Gist options
  • Select an option

  • Save ccerv1/fbeae94762dbba456597ddc3de33e2d7 to your computer and use it in GitHub Desktop.

Select an option

Save ccerv1/fbeae94762dbba456597ddc3de33e2d7 to your computer and use it in GitHub Desktop.
Adds CAGR to the labels and a title that explains the key message
labels = []
y_vals = []
cum_sum = 0
for col_num, country_name in enumerate(production_table.columns):
label = country_name + " " + cagr(production_table[country_name])
labels.append(label)
prod_val = production_table.iloc[-1,col_num]
y_vals.append((cum_sum * 2 + prod_val)/2)
cum_sum += prod_val
for i, label in enumerate(labels):
ax.text(x=2019.2, y=y_vals[i], s=label)
ax.set_title("Brazil and Vietnam have increased their market share from 33% in 1995 to over 50% today")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment