def create_five_battles_minimum_chart(buckets, watermark_text='@WOTC_Tracker'):
    plt.clf()
    fig = plt.figure(figsize=(11, 8), dpi=150)
    fig.suptitle('Number of accounts having played at least 5 battles')
    ax1 = fig.add_subplot(111)
    width = 0.25
    keys = [(datetime.strptime(d, '%Y-%m-%d') - timedelta(days=1)) for d in buckets['all'].keys()]
    xkeys = [(d - timedelta(hours=3)) for d in keys]
    pkeys = [(d + timedelta(hours=3)) for d in keys]
    xbox_bars = ax1.bar(xkeys, buckets['xbox'].values(), width=width, color='g')
    ps_bars = ax1.bar(pkeys, buckets['ps'].values(), width=width, color='b')
    ax1.table(cellText=[list(buckets['xbox'].values()), list(buckets['ps'].values()), list(buckets['all'].values())], rowLabels=['xbox', 'ps', 'all'], colLabels=[d.strftime('%Y-%m-%d') for d in keys], loc='bottom')
    ax1.set_ylabel('Accounts')
    ax1.set_xticks([])
    ax1.legend((xbox_bars[0], ps_bars[0]), ('xbox', 'ps'))
    ax1.text(0.5, 1.05, watermark_text, horizontalalignment='center', verticalalignment='center', transform=ax1.transAxes)
    fig.savefig(FIVEADAY_PNG)
def create_five_battles_minimum_chart(buckets, watermark_text='@WOTC_Tracker'):
    plt.clf()
    fig = plt.figure(figsize=(11, 8), dpi=150)
    fig.suptitle('Number of accounts having played at least 5 battles')
    ax1 = fig.add_subplot(111)
    width = 0.25
    keys = [(datetime.strptime(d, '%Y-%m-%d') - timedelta(days=1)) for d in buckets['all'].keys()]
    xkeys = [(d - timedelta(hours=3)) for d in keys]
    pkeys = [(d + timedelta(hours=3)) for d in keys]
    xbox_bars = ax1.bar(xkeys, buckets['xbox'].values(), width=width, color='g')
    ps_bars = ax1.bar(pkeys, buckets['ps'].values(), width=width, color='b')
    ax1.table(cellText=[list(buckets['xbox'].values()), list(buckets['ps'].values()), list(buckets['all'].values())], rowLabels=['xbox', 'ps', 'all'], colLabels=[d.strftime('%Y-%m-%d') for d in keys], loc='bottom')
    ax1.set_ylabel('Accounts')
    ax1.set_xticks([])
    ax1.legend((xbox_bars[0], ps_bars[0]), ('xbox', 'ps'))
    ax1.text(0.5, 1.05, watermark_text, horizontalalignment='center', verticalalignment='center', transform=ax1.transAxes)
    fig.savefig(FIVEADAY_PNG)