Skip to content

Instantly share code, notes, and snippets.

@trollknurr
Created June 8, 2018 12:22
Show Gist options
  • Save trollknurr/9f50175cec7553dcf4cf86e5111ba0a1 to your computer and use it in GitHub Desktop.
Save trollknurr/9f50175cec7553dcf4cf86e5111ba0a1 to your computer and use it in GitHub Desktop.
bar with annotation
ax = plt.gca()
pd.concat([x_rdf[ cf + ['total'] ], activity_rate_abs, tm_res_df_abs.rename('tmdb_votes')], axis=1).plot.bar(
ax=ax, width=0.85
)
plt.legend()
plt.xticks(x_rdf.index, range(13))
for p in ax.patches:
if p.get_height() > 0:
ax.annotate(str(int(p.get_height())),
(p.get_x()+p.get_width()/2., p.get_height()),
ha='center',
va='center',
weight='light',
rotation=90,
size=7.2,
xytext=(0, 10), textcoords='offset points')
ax.set_xlabel('month to start')
ax.set_ylabel('films with feature')
ax.invert_xaxis()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment