Skip to content

Commit

Permalink
analysis: better growth and tag figures
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeff committed Apr 19, 2017
1 parent 194df03 commit b81b0c4
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,18 @@
"d['track_id'].plot(ax=ax1)\n",
"d['indicator'].cumsum().plot(ax=ax1)\n",
"ax1.set_ylabel('#tracks')\n",
"ax1.legend(['track_id', 'collected'], loc='lower right')\n",
"ax1.set_ylim(0, 160000)\n",
"\n",
"d['indicator'].plot(ax=ax2, style='r') # needed for no apparent reason\n",
"color = (0.7686274509803922, 0.3058823529411765, 0.3215686274509804)\n",
"color = sns.color_palette('deep', 3)[2]\n",
"d['indicator'].resample('2M').sum().fillna(0).plot(ax=ax2, style='--', color=color)\n",
"ax2.set_ylabel('#tracks added')\n",
"ax2.set_ylim(900, 3800)\n",
"ax2.set_ylim(500, 4500)\n",
"ax2.grid(False)\n",
"\n",
"lns = ax1.get_lines() + [ax2.get_lines()[1]]\n",
"ax1.legend(lns, ['largest track id', '#tracks still present', '#tracks added per 2 months'], loc='lower right')\n",
"\n",
"plt.savefig('growth.pdf')"
]
},
Expand Down Expand Up @@ -410,6 +415,7 @@
"d = tracks['track', 'tags'].apply(len)\n",
"print(d.min(), d.max())\n",
"d = d[(d.values >= 1) & (d.values <= 16)]\n",
"color = sns.color_palette('deep', 3)[2]\n",
"sns.distplot(d, kde=False, bins=d.max()-d.min(), label='track', ax=ax1, color=color)\n",
"\n",
"d = tracks.drop_duplicates(('album', 'id'))\n",
Expand All @@ -428,8 +434,11 @@
"ax1.set_ylabel('#tracks')\n",
"ax2.set_ylabel('#artists / #albums')\n",
"ax1.set_xlim(d.min(), d.max())\n",
"ax1.legend()\n",
"ax2.legend(loc='upper center')\n",
"ax1.set_ylim(0, 5000)\n",
"ax2.set_ylim(0, 500)\n",
"ax1.legend(loc='upper center')\n",
"ax2.legend(loc='upper right')\n",
"ax2.grid(False)\n",
"\n",
"plt.tight_layout()\n",
"plt.savefig('tag_distribution.pdf')"
Expand Down

0 comments on commit b81b0c4

Please sign in to comment.