diff options
| author | jeanpouget-abadie <jean.pougetabadie@gmail.com> | 2015-12-02 12:31:05 -0500 |
|---|---|---|
| committer | jeanpouget-abadie <jean.pougetabadie@gmail.com> | 2015-12-02 12:31:05 -0500 |
| commit | 5fbd4664e76d25de95f89329ee5f0f912fee4259 (patch) | |
| tree | 05812c8f49cd44aca4ebf19a9b836df41ea33396 /simulation/plot_utils.py | |
| parent | 600251accf79333d487c7186dcc5354e310c84c7 (diff) | |
| download | cascades-5fbd4664e76d25de95f89329ee5f0f912fee4259.tar.gz | |
frequency param introduced + plots_utils file sketch
Diffstat (limited to 'simulation/plot_utils.py')
| -rw-r--r-- | simulation/plot_utils.py | 26 |
1 files changed, 26 insertions, 0 deletions
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) |
