From 5fbd4664e76d25de95f89329ee5f0f912fee4259 Mon Sep 17 00:00:00 2001 From: jeanpouget-abadie Date: Wed, 2 Dec 2015 12:31:05 -0500 Subject: frequency param introduced + plots_utils file sketch --- simulation/plot_utils.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 simulation/plot_utils.py (limited to 'simulation/plot_utils.py') diff --git a/simulation/plot_utils.py b/simulation/plot_utils.py new file mode 100644 index 0000000..af5269c --- /dev/null +++ b/simulation/plot_utils.py @@ -0,0 +1,26 @@ +import matplotlib.pyplot as plt +import argparse +import json +import seaborn +seaborn.set_style('whitegrid') + +parser = argparse.ArgumentParser(description='Process logs') +parser.add_argument('-x', help='name of parameters on x axis', default='time') +parser.add_argument('-y', help='name of parameters on y axis', default='rmse') +parser.add_argument('f', help='list of logs to parse', nargs='+') +parser.add_argument('-dest', help='name of figure to save', default='fig.png') +args = parser.parse_args() + +for file_name in args.f: + x, y = [], [] + with open(file_name) as f: + for line in f: + jason = json.loads(line) + x.append(jason[args.x]) + y.append(jason[args.y]) + plt.plot(x, y, label=file_name) + +plt.legend() +plt.xlabel(args.x) +plt.ylabel(args.y) +plt.savefig(args.dest) -- cgit v1.2.3-70-g09d2