-
Notifications
You must be signed in to change notification settings - Fork 0
/
plots.py
26 lines (22 loc) · 826 Bytes
/
plots.py
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
import numpy as np
import matplotlib.pyplot as plt
import sys
import glob
from os import path
for mask in sys.argv[1:]:
for file in glob.glob(mask):
fname = path.split(file.split('.')[0])[1]
data = np.loadtxt(file, skiprows=1)
titles = open(file, 'r').readline().split()[1:]
nums = data[:, 0]
results = data[:, 1:]
fig = plt.figure(figsize=(7, 5))
ax = fig.add_subplot(111, xscale='log', yscale='log')
for i in range(len(titles)):
ax.plot(nums, results[:, i], 'o-', label=titles[i])
ax.legend()
ax.set_xlabel(open(file, 'r').readline().split()[0], fontsize=15)
ax.set_ylabel('time, s', fontsize=15)
ax.set_title(fname, fontsize=20)
fig.savefig(file.split('.')[0] + '.png', dpi=200)
fig.clear()