forked from navjotk/error_propagation
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_forward_error.py
More file actions
34 lines (25 loc) · 807 Bytes
/
plot_forward_error.py
File metadata and controls
34 lines (25 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from argparse import ArgumentParser
import tikzplotlib
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt # noqa
from util import read_csv # noqa
description = ("Plot the forward propagation errors")
parser = ArgumentParser(description=description)
parser.add_argument("--filename", type=str, required=True)
args = parser.parse_args()
filename = args.filename
results = read_csv(filename)
basename = "forward"
xvar = 'ntimesteps'
yvars = ['L0', 'L1', 'L2', 'Linf']
x_to_plot = results[xvar]
for yvar in yvars:
# plt.xscale('log')
# plt.yscale('log')
plt.plot(x_to_plot, results[yvar])
plt.xlabel(xvar)
plt.ylabel(yvar)
plt.savefig("%s_%s.pdf" % (basename, yvar), bbox_inches='tight')
tikzplotlib.save("%s_%s.tex" % (basename, yvar))
plt.clf()