-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotter.py
50 lines (40 loc) · 1.18 KB
/
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
#! /usr/bin/python
import matplotlib
matplotlib.use('Agg')
import os
import sys
import numpy as np
import pandas as pd
import datetime
#import matplotlib
import matplotlib.pyplot as plt
import matplotlib.dates as md
import matplotlib.dates as mdates
from matplotlib import dates
#matplotlib.use('Agg')
from datetime import date
import csv
try:
filename = sys.argv[1]
except:
filename = datetime.datetime.now().strftime("%Y%m%d")
print filename
dataF = np.genfromtxt('log/'+filename, delimiter='\t', invalid_raise=0, names=['None', 'time', 'intensity'])
fig = plt.figure(figsize=(20, 10))
ax = fig.add_subplot(111)
dts = map(datetime.datetime.fromtimestamp, dataF['time'])
fds = dates.date2num(dts)
hfmt = dates.DateFormatter('%H:%M')
ax.xaxis.set_major_locator(dates.HourLocator())
ax.xaxis.set_major_formatter(hfmt)
plt.plot(fds, dataF['intensity'], 'ro', c='blue', lw=1.5, label='Intenzita') # tepla voda
plt.ylim(-16.5,-8)
ax.set_ylabel('value [X]')
ax.set_xlabel('Cas [h]')
fig.suptitle('Slunce, ' + filename, fontsize=14, fontweight='bold')
plt.grid()
plt.savefig('/media/nfs/Slunce_sumy/OUT/'+filename+'.png', bbox_inches='tight', dpi=300)
try:
plt.show()
except:
print "Neni X"