|
|
@@ -28,7 +28,6 @@ import matplotlib.pyplot as plt
|
|
|
import argparse
|
|
|
import re
|
|
|
import numpy as np
|
|
|
-import cubehelix
|
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
@@ -102,16 +101,13 @@ plt.xlabel('Date', fontsize='large')
|
|
|
plt.minorticks_on()
|
|
|
plt.title(args.title + ' - Email Send Times', fontsize='large')
|
|
|
|
|
|
-scolor = cubehelix.cmap(startHue=240, endHue=-300,
|
|
|
- minSat=1, maxSat=2.5,
|
|
|
- minLight=.3, maxLight=.8,
|
|
|
- gamma=.9)
|
|
|
+viridis = plt.get_cmap('viridis')
|
|
|
|
|
|
if args.sendercolors:
|
|
|
for plid in enumerate(slist):
|
|
|
plt.plot_date(np.array(pldata[plid[1]])[:, 0],
|
|
|
np.array(pldata[plid[1]])[:, 1],
|
|
|
- color=scolor(plid[0] / (nsend + 1)),
|
|
|
+ color=viridis(plid[0] / (nsend + 1)),
|
|
|
marker='.',
|
|
|
#tz=z.tzname(),
|
|
|
label=plid[1],
|
|
|
@@ -120,7 +116,7 @@ if args.sendercolors:
|
|
|
if len(pldata['unknown']) > 0:
|
|
|
plt.plot_date(np.array(pldata['unknown'])[:, 0],
|
|
|
np.array(pldata['unknown'])[:, 1],
|
|
|
- color=scolor(1),
|
|
|
+ color=viridis(1),
|
|
|
marker='.',
|
|
|
#tz=z.tzname(),
|
|
|
label='unknown',
|
|
|
@@ -145,6 +141,8 @@ plt.title(args.title, fontsize='large')
|
|
|
months = list(senders.keys())
|
|
|
months.sort()
|
|
|
|
|
|
+total = np.zeros(len(months))
|
|
|
+
|
|
|
for j in range(len(domains) + 1):
|
|
|
domainlist = []
|
|
|
if j == 0:
|
|
|
@@ -154,9 +152,20 @@ for j in range(len(domains) + 1):
|
|
|
|
|
|
for month in months:
|
|
|
domainlist.append(senders[month][j])
|
|
|
+ if np.all(np.array(domainlist) == 0):
|
|
|
+ # skip domains with zero emails sent over the entire duration
|
|
|
+ continue
|
|
|
plt.plot(np.arange(len(months)),
|
|
|
domainlist,
|
|
|
label=label)
|
|
|
+ total += domainlist
|
|
|
+
|
|
|
+plt.plot(np.arange(len(months)),
|
|
|
+ total,
|
|
|
+ color='k',
|
|
|
+ ls='--',
|
|
|
+ alpha=0.4,
|
|
|
+ label='All Emails')
|
|
|
|
|
|
plt.legend(frameon=False, loc='best')
|
|
|
plt.xticks(np.arange(len(months)), months, rotation=90)
|