Skip to content

Instantly share code, notes, and snippets.

@DalyaG
Last active May 9, 2020 20:35
Show Gist options
  • Save DalyaG/8fa4483f19515f13ffbfdd6a7494a0ed to your computer and use it in GitHub Desktop.
Save DalyaG/8fa4483f19515f13ffbfdd6a7494a0ed to your computer and use it in GitHub Desktop.
import matplotlib.pyplot as plt
df_sample_grouped = df_sample.groupby(['birthday']).size()
n_unique_dates = len(df_sample_grouped.index.unique())
fig = plt.figure(figsize=(n_unique_dates/5, n_unique_dates/10))
ax = df_sample_grouped.plot.bar(x="birthday", y="n_pets", color='blue')
ax.set_xticklabels(labels=df_sample_grouped.index, rotation=70, rotation_mode="anchor", ha="right");
ax.legend(labels=['n_pets']);
plt.tight_layout()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment