Last active
February 1, 2020 20:51
-
-
Save rchardptrsn/198c8933256d1e9639e154d85baa6a00 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import seaborn as sns | |
| import matplotlib.pyplot as plt | |
| from matplotlib.collections import LineCollection | |
| # Initialize figure and size of the plot | |
| plt.figure(figsize=(14,8)) | |
| # Seaborn line plot | |
| ax = sns.lineplot(x='Year',y='Average GDP Pct Change', | |
| data=pct_change, | |
| hue='Quartile', | |
| palette='Accent') | |
| # Create a dashed line at zero for comparison | |
| ax.annotate("", | |
| xy=(1961, 0), xycoords='data', | |
| xytext=(2019, 0), textcoords='data', | |
| arrowprops=dict(arrowstyle="-", | |
| ls='dashed', | |
| edgecolor = "red", | |
| connectionstyle="arc3, rad=0"), | |
| ) | |
| # Set xtick labels and rotate the x-axis labels | |
| plt.setp(ax.get_xticklabels(), rotation=90) | |
| # Set the title | |
| plt.title('Average GDP Percent Change per Year - Quartiles') | |
| # Grab the figure | |
| fig = ax.get_figure() | |
| # Save the figure | |
| fig.savefig('Avg GDP pct change') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment