-
Notifications
You must be signed in to change notification settings - Fork 3
/
plotlist.py
executable file
·41 lines (32 loc) · 918 Bytes
/
plotlist.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
#!/usr/bin/env python3
from string import *
#import os, commands, getopt, sys, exceptions
import numpy as np
import matplotlib.pyplot as plt
#
# simple script to plot x-y curve from text file
#
#
# read in data (y axis data):
#filename = "swtc2-ne30.linf.errors"
filename = "swtc2-CA.linf.errors"
title = "SWTC2"
ylabel = "max error"
#filename = "TBOT.out"
#title = "min tbot"
#ylabel = "degrees K'
print("reading file...")
data = np.loadtxt(filename,usecols=(1,))
t = np.loadtxt(filename,usecols=(0,))
# or compute time based on knowledge of timestep between samples:
# statefreq=24, timestep=8.33s
#delta = 24*8.3333333333333333333/(24*3600.)
#t = np.arange(0, delta*data.size, delta)
print("constructing plot...")
fig, axs = plt.subplots()
axs.plot(t,data,label=title,color='b')
axs.grid(True)
axs.set(xlabel='days', ylabel=ylabel,title=title)
#plt.show()
print("writing plot...")
plt.savefig("temp.png")