add option to save graph to a file
This commit is contained in:
parent
519c0abc88
commit
34cbd3720a
|
@ -12,6 +12,7 @@ class GraphCommand(BaseCommand):
|
|||
parser.add_argument('--datemax', metavar='DATEMAX')
|
||||
parser.add_argument('--committime', action='store_true',
|
||||
help='use commit datetime instead of author datetime')
|
||||
parser.add_argument('--filename', metavar='FILENAME')
|
||||
|
||||
def get_commits(self, options):
|
||||
filters = {'author_email__endswith': '@entrouvert.com'}
|
||||
|
@ -41,4 +42,7 @@ class GraphCommand(BaseCommand):
|
|||
|
||||
def plot(self, options):
|
||||
plt.title(self.get_title(options))
|
||||
plt.show()
|
||||
if options.get('filename'):
|
||||
plt.savefig(options['filename'])
|
||||
else:
|
||||
plt.show()
|
||||
|
|
Reference in New Issue