From b3a4cfe1e1152e332fb69db498bdb8184b212e76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Wed, 8 Jul 2020 15:27:28 +0200 Subject: [PATCH] add --output-dir argument for images MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jakub SokoĊ‚owski --- main.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 9ffbd98..958f16b 100755 --- a/main.py +++ b/main.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3 +from os import path from optparse import OptionParser from query import ESQueryPeers @@ -22,6 +23,8 @@ def parse_opts(): help='Max number of counts to find.') parser.add_option('-d', '--image-dpi', default=200, help='DPI of generated PNG images.') + parser.add_option('-o', '--output-dir', default='./', + help='Dir into which images are generated.') (opts, args) = parser.parse_args() if not opts.field: @@ -43,10 +46,12 @@ def main(): pdg = PDGraphPeers(data) plot = pdg.days_per_peers() - plot.figure.savefig("days_per_peers.png", dpi=opts.image_dpi) + plot.figure.savefig(path.join(opts.output_dir, "days_per_peers.png"), + dpi=opts.image_dpi) matrix = pdg.weekly_cohorts() - matrix.figure.savefig("weekly_cohorts.png", dpi=opts.image_dpi) + matrix.figure.savefig(path.join(opts.output_dir, "weekly_cohorts.png"), + dpi=opts.image_dpi) if __name__ == '__main__':