Last active
May 21, 2021 10:57
-
-
Save max-torch/d23c8f6239674d66df8b5848ef963a0b to your computer and use it in GitHub Desktop.
bssoupblog4
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
resampled_df_m = df_no_refund.resample('M', on='Date').sum().reset_index() | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
sns.set_context('poster') | |
sns.set_style("darkgrid") | |
plt.figure(figsize = (16, 8)) | |
ax = sns.barplot(data = resampled_df_m, x="Date", y="Total") | |
ax.set_xticklabels(resampled_df_m.Date.dt.month_name()) | |
plt.xticks(rotation=90, size=14) | |
xposition = [8.5, 20.5, 32.5, 44.5] | |
for xc in xposition: | |
plt.axvline(x=xc, color='k', linestyle='--', linewidth=1.5) | |
xcoord = [4] + [each - 6.25 for each in xposition[1:]] + [44.5+9] | |
year = ['2016', '2017', '2018', '2019', '2020'] | |
for x, year in zip(xcoord, year): | |
plt.text(x, 2090, year, ha='center', va='center') | |
plt.xlabel('') | |
plt.ylabel('Total Expense') | |
plt.title('Monthly Totals of Steam Purchases') | |
plt.savefig('MonthlyTotal.png', transparent=False, bbox_inches='tight') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment