-
Notifications
You must be signed in to change notification settings - Fork 19
/
ys_plotter.py
72 lines (61 loc) · 1.65 KB
/
ys_plotter.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
"""
Plotting data generated by hah_test
Youngung Jeong
"""
import matplotlib.pyplot as plt
import os
import glob
import numpy as np
import vpscyld.lib_dat
def comb(fns):
"""
Arguments
---------
fns
"""
ls=['-','-','-','-','--',':','--','-','--']
fig=plt.figure(figsize=(7,3))
ax1=fig.add_subplot(121)
ax2=fig.add_subplot(122)
for i in range(len(fns)):
dat=np.loadtxt(fns[i]).T
label = fns[i].split('.')[0]
ax1.plot(dat[0],dat[1],label=label,ls=ls[i])
ax2.plot(dat[4],dat[5],label=label,ls=ls[i])
ax1.grid(); ax2.grid()
ax1.legend(fontsize=6,ncol=3,bbox_to_anchor=(1,1.2))
ax2.legend(fontsize=6,ncol=3,bbox_to_anchor=(1,1.2))
ax1.set_aspect('equal'); ax2.set_aspect('equal')
fnPdf='all_ys.pdf'
print('Figure saved to <%s>'%fnPdf)
vpscyld.lib_dat.pi_rad(ax2,150)
fig.savefig(fnPdf,bbox_inches='tight')
def main(fn='ys.txt'):
"""
Argument
--------
fn='ys.txt'
"""
fig=plt.figure(figsize=(3.5,3))
ax=fig.add_subplot(111)
dat=np.loadtxt(fn).T
ax.plot(dat[0],dat[1])
ax.grid()
fnPdf='%s.pdf'%fn.split('.')[0]
fig.savefig(fnPdf,bbox_inches='tight')
return fnPdf
if __name__=='__main__':
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
'-f',type=str,help='a list of filenames',default=None)
args = parser.parse_args()
if type(args.f)==type(None):
hah_fns = glob.glob('hah*.txt')
else:
hah_fns = args.f.split()
comb(hah_fns)
# for i in xrange(len(fns)):
# fnPdf=main(fns[i])
# print '%s->%s'%(fns[i],fnPdf)