From 4375265f87f9a3188982ed15424a109797ea4f51 Mon Sep 17 00:00:00 2001 From: jeanpouget-abadie Date: Thu, 3 Dec 2015 23:10:30 -0500 Subject: adding plot for poster --- simulation/plot_utils.py | 48 +++++++++++++++++++++++++++++++++----------- simulation/plots/finale.png | Bin 0 -> 45728 bytes 2 files changed, 36 insertions(+), 12 deletions(-) create mode 100644 simulation/plots/finale.png diff --git a/simulation/plot_utils.py b/simulation/plot_utils.py index af5269c..9472707 100644 --- a/simulation/plot_utils.py +++ b/simulation/plot_utils.py @@ -1,4 +1,6 @@ +import numpy as np import matplotlib.pyplot as plt +import matplotlib import argparse import json import seaborn @@ -11,16 +13,38 @@ 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) +def default(): + 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) + +def tmp_finale(): + plt.clf() + for file_name in args.f: + x, y = [], [] + with open(file_name) as f: + for index, line in zip(range(15), f): + assert index <= 15 + jason = json.loads(line) + x.append(jason[args.x]) + y.append(np.sqrt(jason[args.y])) + plt.plot(x, y, label=file_name) + + plt.legend(fontsize=15) + plt.xlabel(r"Nbr of Batches (size $100$)", fontsize=15) + plt.ylabel(r"RMSE", fontsize=15) + plt.savefig(args.dest) + +if __name__ == "__main__": + tmp_finale() diff --git a/simulation/plots/finale.png b/simulation/plots/finale.png new file mode 100644 index 0000000..59378f9 Binary files /dev/null and b/simulation/plots/finale.png differ -- cgit v1.2.3-70-g09d2