times: add cmdline option to set opacity

This commit is contained in:
Frédéric Péters 2017-10-15 21:32:32 +02:00
parent 74c5cecd45
commit 36d791ccad
1 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,10 @@ from .common import GraphCommand
class Command(GraphCommand):
def add_arguments(self, parser):
super(Command, self).add_arguments(parser)
parser.add_argument('--opacity', type=float, default=0.3)
def handle(self, *args, **options):
datetime_var = 'author_datetime'
if options.get('committime'):
@ -18,7 +22,7 @@ class Command(GraphCommand):
event_dates.append(matplotlib.dates.date2num(graph_date.date()))
event_times.append(graph_date.hour + graph_date.minute / 60. + graph_date.second / 3600)
plt.scatter(event_dates, event_times, alpha=0.3)
plt.scatter(event_dates, event_times, alpha=options.get('opacity'))
plt.gca().xaxis.set_major_locator(matplotlib.dates.YearLocator())
plt.gca().xaxis.set_minor_locator(matplotlib.dates.MonthLocator())
plt.gca().xaxis.set_major_formatter(matplotlib.dates.DateFormatter('%m/%Y'))