Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request localwiki#465 from ivanov/ppastats-fixup
Browse files Browse the repository at this point in the history
rotate the month labels so they don't overlap
  • Loading branch information
philipn committed Apr 6, 2013
2 parents 4b720dc + 14b5165 commit f4743a0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions deb_utils/ppastats.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
stats[date] = dict([(r, 0) for r in releases])
stats[date][release] = downloads

try:
def plot_stats(stats):
import numpy as np
import matplotlib
# prevent interactive pop-up
Expand All @@ -73,7 +73,8 @@
kwargs.update(alpha=a,label=r,bottom=prev)
ax.bar(dates, all[i],**kwargs)
a*=.72
plt.gcf().autofmt_xdate(rotation=0, ha='left')
plt.gcf().autofmt_xdate(rotation=70, ha='right')
plt.setp(ax.xaxis.get_majorticklabels(), rotation_mode='anchor', va='center')
l = plt.legend()
l.set_frame_on(False)
# Liberate axis!
Expand All @@ -93,6 +94,11 @@
for r,t in zip(releases,all.sum(1)):
print '%4d :'%t,r
print "Total downloads: ", all.sum()



try:
plot_stats(stats)
except ImportError:
# Couldn't import matplotlib, let's do the old thing
for date, downloads in reversed(stats.items()):
Expand Down

0 comments on commit f4743a0

Please sign in to comment.