Gnuplot Scripts

Posted on
Mon May 18, 2015 7:06 pm
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Gnuplot Scripts

No problem!

I forgot to change the textcolor. (Also, there was a typo which I have fixed as well.)

Code: Select all
#! /usr/bin/env gnuplot
# -*- coding: utf-8 -*-

reset

set terminal pngcairo enhanced background "#000000" font "Lato-Light,9" linewidth 1 rounded size 600,200
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 7 pointsize .5
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 ",8"

# Y2 Axis
set y2tics format "%2.0f%%" nomirror
set y2range [0:100]

plot dataFileForecast using 1:2 with lines,\
    dataFileForecast using 1:2:3 with labels texcolor rgb "white",\
     dataFileForecast using 1:4 with lines,\
     dataFileForecast using 1:2:5 with labels textcolor rgb "white",\
     freezeWarning with lines

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon May 18, 2015 7:07 pm
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Gnuplot Scripts

No problem!

I forgot to change the textcolor. (Also, there was a typo which I have fixed as well.)

Code: Select all
#! /usr/bin/env gnuplot
# -*- coding: utf-8 -*-

reset

set terminal pngcairo enhanced background "#000000" font "Lato-Light,9" linewidth 1 rounded size 600,200
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 7 pointsize .5
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 ",8"

# Y2 Axis
set y2tics format "%2.0f%%" nomirror
set y2range [0:100]

plot dataFileForecast using 1:2 with lines,\
    dataFileForecast using 1:2:3 with labels texcolor rgb "#FFFFFF",\
     dataFileForecast using 1:4 with lines,\
     dataFileForecast using 1:2:5 with labels textcolor rgb "#FFFFFF",\
     freezeWarning with lines

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon May 18, 2015 7:08 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Gnuplot Scripts

Think we lost a line.

Thanks,

Carl
Attachments
10DayForecast.png
10DayForecast.png (7.07 KiB) Viewed 6150 times

Posted on
Mon May 18, 2015 7:11 pm
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Gnuplot Scripts

Yet another typo on my part, sorry!

Code: Select all
#! /usr/bin/env gnuplot
# -*- coding: utf-8 -*-

reset

set terminal pngcairo enhanced background "#000000" font "Lato-Light,9" linewidth 1 rounded size 600,200
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 7 pointsize .5
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 ",8"

# Y2 Axis
set y2tics format "%2.0f%%" nomirror
set y2range [0:100]

plot dataFileForecast using 1:2 with lines,\
    dataFileForecast using 1:2:3 with labels textcolor rgb "#FFFFFF",\
     dataFileForecast using 1:4 with lines,\
     dataFileForecast using 1:2:5 with labels textcolor rgb "#FFFFFF",\
     freezeWarning with lines

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon May 18, 2015 7:15 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Gnuplot Scripts

Numbers!

Highs and lows on top of each other?
Attachments
10DayForecast.png
10DayForecast.png (9.89 KiB) Viewed 6150 times

Posted on
Mon May 18, 2015 7:19 pm
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Gnuplot Scripts

See that second to last line? Change "1:2:5" to "1:4:5". :D

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon May 18, 2015 7:23 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Gnuplot Scripts

Looking great. Any way to have that cool fill?

Thanks,

Carl
Attachments
10DayForecast.png
10DayForecast.png (11.36 KiB) Viewed 6153 times

Posted on
Mon May 18, 2015 7:33 pm
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Gnuplot Scripts

You have Gnuplot 4.6 I believe, so it should be possible.

Try replacing the last line with this and let's see what we get.
Code: Select all
freezeWarning with filledcurves above y1=0

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon May 18, 2015 7:35 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Gnuplot Scripts

Better.
Attachments
10DayForecast.png
10DayForecast.png (11.4 KiB) Viewed 6145 times

Posted on
Mon May 18, 2015 7:43 pm
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Gnuplot Scripts

That's terrific. Are you seeing how this is coming together? The tweaking is easier now.

Let's replace the entire plot segment with this:
Code: Select all
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:2:5 with labels textcolor rgb "#FFFFFF",\
     freezeWarning with filledcurves above y1=0

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon May 18, 2015 7:47 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Gnuplot Scripts

Looks great to me. Hate to take up anymore of your time.

Thanks,

Carl

edit: Precip lines?
Attachments
10DayForecast.png
10DayForecast.png (12.83 KiB) Viewed 6131 times

Posted on
Mon May 18, 2015 8:00 pm
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Gnuplot Scripts

Truly not a problem. Don't worry about that at all! :D

Code: Select all
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

Completely happy to continue with the help; I'm hoping that the thread will provide help to others, too!

Dave

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon May 18, 2015 8:08 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Gnuplot Scripts

Maybe one last tweek?
If the bottom fill could stay the cool blue for below 32 that would be perfect.

edit: I adjusted the sizing a bit.

Carl
Attachments
10DayForecast.png
10DayForecast.png (26.4 KiB) Viewed 6116 times

Posted on
Mon May 18, 2015 8:24 pm
DaveL17 offline
User avatar
Posts: 6759
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Re: Gnuplot Scripts

You can change the colors any way you like!

line color:
Code: Select all
linecolor rgb "#FFFFFF"

text color:
Code: Select all
textcolor rgb "#FFFFFF"

All you need to do is change the RGB value to whatever color you like.

http://www.colorpicker.com/

We haven't specified a linecolor, so Gnuplot is picking for us. To change that, all we need to do is ask, by adding it to the proper line (in this case, the last one):
Code: Select all
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"

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Posted on
Mon May 18, 2015 8:43 pm
ckeyes888 offline
Posts: 2425
Joined: Nov 26, 2009
Location: Kalispell, MT

Re: Gnuplot Scripts

Love it Dave! Working on the CP for it now.

Many thanks again, I do hope you're right in that others find it useful.

Carl

Page 4 of 10 1, 2, 3, 4, 5, 6, 7 ... 10

Who is online

Users browsing this forum: No registered users and 5 guests