import matplotlib.pyplot as plt Country = ['USA','Japan','Germany','UK','France','Turkey','Mexico','Italy','Canada','Spain'] StringencyIndex = [55.8,41.1,59.3,58.3,56.9,63.6,64.6,62.3,61.2,53.4] plt.figure(figsize=(10,4)) plt.bar(Country, StringencyIndex) plt.xticks(rotation=0) plt.xlabel("Country") plt.ylabel("Average Stringency Index") plt.title("Average Stringency Index of the 10 Wealthiest OECD Countries from 2020-2021") def addlabels(x,y): for i in range(len(x)): plt.text(i, y[i], y[i], ha = 'center') addlabels(Country, StringencyIndex) plt.savefig('stringency.png', dpi=300, bbox_inches='tight') plt.show()
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter