|
|
@@ -92,50 +92,50 @@ for msg in a:
|
|
|
|
|
|
# Email send times as a function of day
|
|
|
|
|
|
-plt.figure()
|
|
|
-plt.ylim([0, 24])
|
|
|
-plt.yticks(4*np.arange(7))
|
|
|
-plt.ylabel('Hour', fontsize='large')
|
|
|
-plt.xlabel('Date', fontsize='large')
|
|
|
-plt.minorticks_on()
|
|
|
-plt.title(args.title + ' - Email Send Times', fontsize='large')
|
|
|
+fig, ax = plt.subplots(1, 1)
|
|
|
+ax.set_ylim([0, 24])
|
|
|
+ax.set_yticks(4*np.arange(7))
|
|
|
+ax.set_ylabel('Hour', fontsize='large')
|
|
|
+ax.set_xlabel('Date', fontsize='large')
|
|
|
+ax.minorticks_on()
|
|
|
+ax.set_title(args.title + ' - Email Send Times', fontsize='large')
|
|
|
|
|
|
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=viridis(plid[0] / (nsend + 1)),
|
|
|
- marker='.',
|
|
|
- #tz=z.tzname(),
|
|
|
- label=plid[1],
|
|
|
- xdate=True)
|
|
|
+ ax.plot_date(np.array(pldata[plid[1]])[:, 0],
|
|
|
+ np.array(pldata[plid[1]])[:, 1],
|
|
|
+ color=viridis(plid[0] / (nsend + 1)),
|
|
|
+ marker='.',
|
|
|
+ #tz=z.tzname(),
|
|
|
+ label=plid[1],
|
|
|
+ xdate=True)
|
|
|
|
|
|
if len(pldata['unknown']) > 0:
|
|
|
- plt.plot_date(np.array(pldata['unknown'])[:, 0],
|
|
|
- np.array(pldata['unknown'])[:, 1],
|
|
|
- color=viridis(1),
|
|
|
- marker='.',
|
|
|
- #tz=z.tzname(),
|
|
|
- label='unknown',
|
|
|
- xdate=True)
|
|
|
+ ax.plot_date(np.array(pldata['unknown'])[:, 0],
|
|
|
+ np.array(pldata['unknown'])[:, 1],
|
|
|
+ color=viridis(1),
|
|
|
+ marker='.',
|
|
|
+ #tz=z.tzname(),
|
|
|
+ label='unknown',
|
|
|
+ xdate=True)
|
|
|
|
|
|
if args.sendercolors:
|
|
|
- plt.legend(loc='upper left', ncol=nsend + 1)
|
|
|
+ ax.legend(loc='upper left', ncol=nsend + 1)
|
|
|
|
|
|
if args.plotroot:
|
|
|
- plt.savefig(args.plotroot + '-send_times.png')
|
|
|
+ fig.savefig(args.plotroot + '-send_times.png')
|
|
|
else:
|
|
|
- plt.savefig('send_times.png')
|
|
|
+ fig.savefig('send_times.png')
|
|
|
|
|
|
|
|
|
# Email destination domains as a function of month
|
|
|
-plt.figure()
|
|
|
-plt.ylabel(r'Emails sent to Domain', fontsize='large')
|
|
|
-plt.xlabel(r'Year$-$Month', fontsize='large')
|
|
|
-plt.minorticks_on()
|
|
|
-plt.title(args.title, fontsize='large')
|
|
|
+fig, ax = plt.subplots(1, 1)
|
|
|
+ax.set_ylabel(r'Emails sent to Domain', fontsize='large')
|
|
|
+ax.set_xlabel(r'Year$-$Month', fontsize='large')
|
|
|
+ax.minorticks_on()
|
|
|
+ax.set_title(args.title, fontsize='large')
|
|
|
|
|
|
months = list(senders.keys())
|
|
|
months.sort()
|
|
|
@@ -154,31 +154,35 @@ for j in range(len(domains) + 1):
|
|
|
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)
|
|
|
+ ax.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.annotate('N={0:1.0f}'.format(np.sum(total)),
|
|
|
- (0.99, 0.99),
|
|
|
- ha='right',
|
|
|
- va='top',
|
|
|
- xycoords='axes fraction')
|
|
|
-
|
|
|
-plt.legend(frameon=False, loc='best')
|
|
|
-plt.xticks(np.arange(len(months)), months, rotation=90)
|
|
|
-plt.setp(plt.axes().get_xticklabels(), visible=False)
|
|
|
-plt.setp(plt.axes().get_xticklabels()[::6], visible=True)
|
|
|
-plt.ylim(bottom=0)
|
|
|
+ax.plot(np.arange(len(months)),
|
|
|
+ total,
|
|
|
+ color='k',
|
|
|
+ ls='--',
|
|
|
+ alpha=0.4,
|
|
|
+ label='All Emails')
|
|
|
+
|
|
|
+ax.annotate('N={0:1.0f}'.format(np.sum(total)),
|
|
|
+ (0.99, 0.99),
|
|
|
+ ha='right',
|
|
|
+ va='top',
|
|
|
+ xycoords='axes fraction')
|
|
|
+
|
|
|
+ax.legend(frameon=False, loc='best')
|
|
|
+ax.set_xticks(np.arange(len(months)),
|
|
|
+ months)
|
|
|
+ax.tick_params(axis='x',
|
|
|
+ labelrotation=90)
|
|
|
+# set every other sixth ticklabel as visible
|
|
|
+plt.setp(ax.get_xticklabels(), visible=False)
|
|
|
+plt.setp(ax.get_xticklabels()[::6], visible=True)
|
|
|
+ax.set_ylim(bottom=0)
|
|
|
|
|
|
if args.plotroot:
|
|
|
- plt.savefig(args.plotroot + '-destinations.png', bbox_inches='tight')
|
|
|
+ fig.savefig(args.plotroot + '-destinations.png', bbox_inches='tight')
|
|
|
else:
|
|
|
- plt.savefig('email_destinations.png', bbox_inches='tight')
|
|
|
+ fig.savefig('email_destinations.png', bbox_inches='tight')
|