I'm behind the curve while running OS X 10.9.5 and Gnuplot 5.0.0 and, since everything seems to be quite stable and working the way that I want it to, I'm hesitant to change anything!

Dave
#! /usr/bin/env gnuplot
# -*- coding: utf-8 -*-
reset
set terminal pngcairo enhanced background "#000000" font "Lato-Light,16" linewidth 2 rounded size 800,400
set output "/Users/TV/10DayForecast.png"
dataFileForecast = "/Users/TV/10DayForecast.csv"
set datafile separator ','
set timefmt "%Y-%m-%d"
stats dataFileForecast using 2:4 nooutput
freezeWarning = 32.
Yhigh = STATS_max_x + 10.
Ylow = STATS_min_y - 10.
freezeLabel = ((freezeWarning-Ylow) / (Yhigh-Ylow))
unset key
set border linetype rgb "#666666"
set boxwidth 0.25 relative
set style fill transparent solid 0.4
set style line 1 linetype rgb "#0066CC"
set style line 2 linetype rgb "#FFFFFF" pointtype 14 pointsize 2
set style line 3 linetype rgb "#666666"
set style line 4 linetype rgb "#FFFF00"
set style line 5 linetype rgb "#333333"
set label "°" right
unset mxtics
set tics textcolor rgb "#666666"
# X Axis
set xdata time
set xtics format "%a" nomirror
set autoscale xfix
set offsets 12*60*60,12*60*60,0,0
# Y Axis
set ytics format "%2f°" nomirror
set yrange [Ylow:Yhigh]
unset ytics
if (32 > Ylow) set label "32°" at graph 0.01,freezeLabel tc rgb "#FFFFFF" font ",10"
# Y2 Axis
set y2tics format "%2.0f%%" nomirror
set y2range [0:100]
plot dataFileForecast using 1:2 with filledcurves above y1=0,\
dataFileForecast using 1:2:3 with labels textcolor rgb "#FFFFFF",\
dataFileForecast using 1:4 with filledcurves above y1=0,\
dataFileForecast using 1:4:5 with labels textcolor rgb "#FFFFFF",\
dataFileForecast using 1:6 with impulses,\
freezeWarning with filledcurves above y1=0 linecolor rgb "#0066CC"
plot dataFileForecast using 1:2 with filled curves above y1=0 linecolor "#333333" ,\
dataFileForecast using 1:2:3 with labels textcolor rgb "#FFFFFF",\
dataFileForecast using 1:4 with filledcurves above y1=0 linecolor "#666666",\
dataFileForecast using 1:4:5 with labels textcolor rgb "#FFFFFF",\
dataFileForecast using 1:6 with impulses,\
freezeWarning with filledcurves above y1=0 linecolor rgb "#0066CC"
plot dataFileForecast using 1:2 with filledcurves above y1=0,\
dataFileForecast using 1:2:3 with labels textcolor rgb "#FFFFFF",\
dataFileForecast using 1:4 with filledcurves above y1=0,\
dataFileForecast using 1:4:5 with labels textcolor rgb "#FFFFFF",\
dataFileForecast using 1:6 with impulses,\
freezeWarning with filledcurves above y1=0 linecolor rgb "#0066CC"
#! /usr/bin/env gnuplot
# -*- coding: utf-8 -*-
reset
set terminal pngcairo enhanced background "#000000" font "Lato-Light,16" linewidth 2 rounded size 800,400
set output "/Users/TV/10DayForecast.png"
dataFileForecast = "/Users/TV/10DayForecast.csv"
set datafile separator ','
set timefmt "%Y-%m-%d"
stats dataFileForecast using 2:4 nooutput
freezeWarning = 32.
Yhigh = STATS_max_x + 10.
Ylow = STATS_min_y - 10.
freezeLabel = ((freezeWarning-Ylow) / (Yhigh-Ylow))
unset key
set border linetype rgb "#666666"
set boxwidth 0.25 relative
set style fill transparent solid 0.4
set style line 1 linetype rgb "#0066CC"
set style line 2 linetype rgb "#FFFFFF" pointtype 14 pointsize 2
set style line 3 linetype rgb "#666666"
set style line 4 linetype rgb "#FFFF00"
set style line 5 linetype rgb "#333333"
set label "°" right
unset mxtics
set tics textcolor rgb "#666666"
# X Axis
set xdata time
set xtics format "%a" nomirror
set autoscale xfix
set offsets 12*60*60,12*60*60,0,0
# Y Axis
set ytics format "%2f°" nomirror
set yrange [Ylow:Yhigh]
unset ytics
if (32 > Ylow) set label "32°" at graph 0.01,freezeLabel tc rgb "#FFFFFF" font ",10"
# Y2 Axis
set y2tics format "%2.0f%%" nomirror
set y2range [0:100]
plot dataFileForecast using 1:2 with filled curves above y1=0 linecolor "#333333" ,\
dataFileForecast using 1:2:3 with labels textcolor rgb "#FFFFFF",\
dataFileForecast using 1:4 with filledcurves above y1=0 linecolor "#666666",\
dataFileForecast using 1:4:5 with labels textcolor rgb "#FFFFFF",\
dataFileForecast using 1:6 with impulses,\
freezeWarning with filledcurves above y1=0 linecolor rgb "#0066CC"
plot dataFileForecast using 1:2 with filledcurves above y1=0 linecolor "#333333",\
dataFileForecast using 1:2:3 with labels textcolor rgb "#FFFFFF",\
dataFileForecast using 1:4 with filledcurves above y1=0 linecolor "#666666",\
dataFileForecast using 1:4:5 with labels textcolor rgb "#FFFFFF",\
dataFileForecast using 1:6 with impulses,\
freezeWarning with filledcurves above y1=0 linecolor rgb "#0066CC"
afulki wrote:To get the fill I had to add (0)in the script:
plot dataFileForecast using 1:6 with impulses linestyle 4 axes x1y2,\
dataFileForecast using 1:2:(0) with filledcurves above y1=0 linestyle 5 axes x1y1,\
dataFileForecast using 1:2 with points linestyle 2 axes x1y1,\
dataFileForecast using 1:2:3 with labels offset 1.75,0.5 textcolor "#FFFFFF" font ",8" axes x1y1,\
dataFileForecast using 1:4:(0) with filledcurves above y1=0 linestyle 3 axes x1y1,\
dataFileForecast using 1:4 with points linestyle 2 axes x1y1,\
dataFileForecast using 1:4:5 with labels offset 1.75,0.5 textcolor "#FFFFFF" font ",8" axes x1y1,\
freezeWarning with filledcurves above y1=0 linestyle 1 axes x1y1
Any possibility of having the python script for the 24 hour forecast (write to csv) posted? (or did I miss it somewhere)
#! /usr/bin/env python2.6
# -*- coding: utf-8 -*-
'''
filename: hourlyForecast.py
This file generates the necessary CSV file for charting the hourly
forecast. It plots the next 24 values for each data element.
'''
import os.path
from os import system
import subprocess
csv_file_path = '/Users/.../Dropbox/Public/hourlyForecast.csv'
path_to_gnuplot = '/opt/local/bin/gnuplot /Users/.../Dropbox/Indigo\ Scripts/'
dev = indigo.devices[1322999615]
date_time = str(indigo.server.getTime())
hour_1 = str(dev.states["h01_timeLong"])
hour_2 = str(dev.states["h02_timeLong"])
hour_3 = str(dev.states["h03_timeLong"])
hour_4 = str(dev.states["h04_timeLong"])
hour_5 = str(dev.states["h05_timeLong"])
hour_6 = str(dev.states["h06_timeLong"])
hour_7 = str(dev.states["h07_timeLong"])
hour_8 = str(dev.states["h08_timeLong"])
hour_9 = str(dev.states["h09_timeLong"])
hour_10 = str(dev.states["h10_timeLong"])
hour_11 = str(dev.states["h11_timeLong"])
hour_12 = str(dev.states["h12_timeLong"])
hour_13 = str(dev.states["h13_timeLong"])
hour_14 = str(dev.states["h14_timeLong"])
hour_15 = str(dev.states["h15_timeLong"])
hour_16 = str(dev.states["h16_timeLong"])
hour_17 = str(dev.states["h17_timeLong"])
hour_18 = str(dev.states["h18_timeLong"])
hour_19 = str(dev.states["h19_timeLong"])
hour_20 = str(dev.states["h20_timeLong"])
hour_21 = str(dev.states["h21_timeLong"])
hour_22 = str(dev.states["h22_timeLong"])
hour_23 = str(dev.states["h23_timeLong"])
hour_24 = str(dev.states["h24_timeLong"])
temp_1 = str(int(dev.states["h01_temp"]))
temp_2 = str(int(dev.states["h02_temp"]))
temp_3 = str(int(dev.states["h03_temp"]))
temp_4 = str(int(dev.states["h04_temp"]))
temp_5 = str(int(dev.states["h05_temp"]))
temp_6 = str(int(dev.states["h06_temp"]))
temp_7 = str(int(dev.states["h07_temp"]))
temp_8 = str(int(dev.states["h08_temp"]))
temp_9 = str(int(dev.states["h09_temp"]))
temp_10 = str(int(dev.states["h10_temp"]))
temp_11 = str(int(dev.states["h11_temp"]))
temp_12 = str(int(dev.states["h12_temp"]))
temp_13 = str(int(dev.states["h13_temp"]))
temp_14 = str(int(dev.states["h14_temp"]))
temp_15 = str(int(dev.states["h15_temp"]))
temp_16 = str(int(dev.states["h16_temp"]))
temp_17 = str(int(dev.states["h17_temp"]))
temp_18 = str(int(dev.states["h18_temp"]))
temp_19 = str(int(dev.states["h19_temp"]))
temp_20 = str(int(dev.states["h20_temp"]))
temp_21 = str(int(dev.states["h21_temp"]))
temp_22 = str(int(dev.states["h22_temp"]))
temp_23 = str(int(dev.states["h23_temp"]))
temp_24 = str(int(dev.states["h24_temp"]))
precip_1 = str(int(dev.states["h01_precip"]))
precip_2 = str(int(dev.states["h02_precip"]))
precip_3 = str(int(dev.states["h03_precip"]))
precip_4 = str(int(dev.states["h04_precip"]))
precip_5 = str(int(dev.states["h05_precip"]))
precip_6 = str(int(dev.states["h06_precip"]))
precip_7 = str(int(dev.states["h07_precip"]))
precip_8 = str(int(dev.states["h08_precip"]))
precip_9 = str(int(dev.states["h09_precip"]))
precip_10 = str(int(dev.states["h10_precip"]))
precip_11 = str(int(dev.states["h11_precip"]))
precip_12 = str(int(dev.states["h12_precip"]))
precip_13 = str(int(dev.states["h13_precip"]))
precip_14 = str(int(dev.states["h14_precip"]))
precip_15 = str(int(dev.states["h15_precip"]))
precip_16 = str(int(dev.states["h16_precip"]))
precip_17 = str(int(dev.states["h17_precip"]))
precip_18 = str(int(dev.states["h18_precip"]))
precip_19 = str(int(dev.states["h19_precip"]))
precip_20 = str(int(dev.states["h20_precip"]))
precip_21 = str(int(dev.states["h21_precip"]))
precip_22 = str(int(dev.states["h22_precip"]))
precip_23 = str(int(dev.states["h23_precip"]))
precip_24 = str(int(dev.states["h24_precip"]))
csv_file = open(csv_file_path, "w")
element = (
hour_1 + "," + temp_1 + "," + precip_1 + "," + temp_1 + "°\n" +
hour_2 + "," + temp_2 + "," + precip_2 + "," + temp_2 + "°\n" +
hour_3 + "," + temp_3 + "," + precip_3 + "," + temp_3 + "°\n" +
hour_4 + "," + temp_4 + "," + precip_4 + "," + temp_4 + "°\n" +
hour_5 + "," + temp_5 + "," + precip_5 + "," + temp_5 + "°\n" +
hour_6 + "," + temp_6 + "," + precip_6 + "," + temp_6 + "°\n" +
hour_7 + "," + temp_7 + "," + precip_7 + "," + temp_7 + "°\n" +
hour_8 + "," + temp_8 + "," + precip_8 + "," + temp_8 + "°\n" +
hour_9 + "," + temp_9 + "," + precip_9 + "," + temp_9 + "°\n" +
hour_10 + "," + temp_10 + "," + precip_10 + "," + temp_10 + "°\n" +
hour_11 + "," + temp_11 + "," + precip_11 + "," + temp_11 + "°\n" +
hour_12 + "," + temp_12 + "," + precip_12 + "," + temp_12 + "°\n" +
hour_13 + "," + temp_13 + "," + precip_13 + "," + temp_13 + "°\n" +
hour_14 + "," + temp_14 + "," + precip_14 + "," + temp_14 + "°\n" +
hour_15 + "," + temp_15 + "," + precip_15 + "," + temp_15 + "°\n" +
hour_16 + "," + temp_16 + "," + precip_16 + "," + temp_16 + "°\n" +
hour_17 + "," + temp_17 + "," + precip_17 + "," + temp_17 + "°\n" +
hour_18 + "," + temp_18 + "," + precip_18 + "," + temp_18 + "°\n" +
hour_19 + "," + temp_19 + "," + precip_19 + "," + temp_19 + "°\n" +
hour_20 + "," + temp_20 + "," + precip_20 + "," + temp_20 + "°\n" +
hour_21 + "," + temp_21 + "," + precip_21 + "," + temp_21 + "°\n" +
hour_22 + "," + temp_22 + "," + precip_22 + "," + temp_22 + "°\n" +
hour_23 + "," + temp_23 + "," + precip_23 + "," + temp_23 + "°\n" +
hour_24 + "," + temp_24 + "," + precip_24 + "," + temp_24 + "°")
csv_file.write(element)
csv_file.close()
proc = subprocess.Popen(path_to_gnuplot + 'hourlyForecast.gp', stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
out, err = proc.communicate()
if len(err) >= 1:
self.errorLog(u"hourlyForecast.py: error = %s" % err)
else:
indigo.server.log(u"hourlyForecast.py: Hourly forecast charts data updated.")
Users browsing this forum: No registered users and 4 guests