Permalink
Browse files

[#5] Plot tweaks

  • Loading branch information...
danmichaelo committed Aug 5, 2013
1 parent 028ed74 commit 13b584fd4308a9579e8f0b17b61a20b0f30e9443
Showing with 11 additions and 3 deletions.
  1. +11 −3 bot/ukbot.py
View
@@ -5,6 +5,7 @@
import numpy as np
import time
import calendar
from datetime import datetime, timedelta
from datetime import time as dt_time
import gettext
@@ -1129,7 +1130,7 @@ def extract_rules(self, txt, catignore_txt):
def plot(self):
import matplotlib.pyplot as plt
w = 16 / 2.54
w = 20 / 2.54
goldenratio = 1.61803399
h = w / goldenratio
fig = plt.figure(figsize=(w, h))
@@ -1187,10 +1188,11 @@ def plot(self):
ax.set_xticklabels([], minor=False)
ax.set_xticks(xt_mid, minor=True)
abday = map(lambda x: calendar.day_abbr[x], [0, 1, 2, 3, 4, 5, 6])
if ndays == 7:
ax.set_xticklabels(['Man', 'Tir', 'Ons', 'Tors', 'Fre', 'Lør', 'Søn'], minor=True)
ax.set_xticklabels(abday, minor=True)
elif ndays == 14:
ax.set_xticklabels(['Man', '', 'Ons', '', 'Fre', '', 'Søn', '', 'Tir', '', 'Tor', '', 'Lør', ''], minor=True)
ax.set_xticklabels([abday[0], '', abday[2], '', abday[4], '', abday[6], '', abday[1], '', abday[3], '', abday[5], ''], minor=True)
elif ndays == 30: # for longer contest show numeral ticks
ax.set_xticklabels(['1', '', '', '', '5', '', '', '', '', '10', '', '', '', '', '15', '', '', '', '', '20', '', '', '', '', '25', '', '', '', '', '30'], minor=True)
elif ndays == 31:
@@ -1215,6 +1217,12 @@ def plot(self):
ax.set_xlim(t0, xt[-1])
ax.set_ylim(0, 1.05 * np.max(yall))
ax.set_xlabel(_('Days'))
ax.set_ylabel(_('Points'))
now = server_tz.localize(datetime.now())
ax.set_title(_('Updated %(date)s') % {'date': now.astimezone(wiki_tz).strftime('%e. %B %Y, %H:%M')})
plt.legend()
ax = plt.gca()
ax.legend(

0 comments on commit 13b584f

Please sign in to comment.