Created
May 9, 2020 18:05
-
-
Save AnasAlmasri/2ac89a4f24f585cbe4e44cf0eb656e1d to your computer and use it in GitHub Desktop.
This file contains 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
# set up our plots | |
fig, axes = plt.subplots(nrows=2, ncols=3) | |
df['views_cumsum'].plot(ax=axes[0,0], title='Views Over Time', c='blue', grid=True).set(ylabel='# of Views') | |
df['reads_cumsum'].plot(ax=axes[0,1], title='Reads Over Time', c='green', grid=True).set(ylabel='# of Reads') | |
df['fans_cumsum'].plot(ax=axes[0,2], title='Fans Over Time', c='red', grid=True).set(ylabel='# of Fans') | |
df[['reads', 'fans']].plot(ax=axes[1,0], title='Reads/Fans by Story', kind='bar', stacked=True, grid=True).legend(['# of Reads', '# of Fans']) | |
df[['reads_cumsum', 'fans_cumsum']].plot.area(ax=axes[1,1], title='Views/Fans Over Time', grid=True).legend(['# of Reads', '# of Fans']) | |
df.groupby('year')['views'].sum().plot.bar(ax=axes[1,2], x='year', y='views', title='Yearly Views', grid=True) | |
# set subplot style | |
plt.tight_layout(pad=1.5) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment