gnuplot question

Pop your questions regarding Home automation software here.....
Post Reply
Kroonen
Member
Member
Posts: 302
Joined: Mon Oct 01, 2007 6:38 pm
Location: Netherlands

gnuplot question

Post by Kroonen »

Hi

I want to graph some with gnuplot, everything works only the xrange not. The problem is quotes where to place what

I have this

the xrange must look like this

set xrange ["2011-01-02_10:20:00":"2011-01-03_10:20:00"]

#!/usr/bin/gnuplot

datey="`date +%Y-%m-%d --date='1 days ago'`"
tijd="`date +%H:%M:%S`"
daten="`date +%Y-%m-%d`"
set terminal png transparent small size 950,400 crop
set output '/var/www/temp/testje.png'
set xdata time
set timefmt '%Y-%m-%d_%H:%M:%S'
set xrange ["$datey"_"$tijd":"$daten"_"$tijd"]

I get

gnuplot> set xrange ["$datey"_"$tijd":"$daten"_"$tijd"]
^
':' or keyword 'to' expected

Any ideas are welcome
User avatar
jrkalf
Member
Member
Posts: 291
Joined: Fri Nov 12, 2010 4:20 pm
Location: Nootdorp
Contact:

Re: gnuplot question

Post by jrkalf »

Oldskool thought, have you tried to backslash the : ?

Code: Select all

set xrange ["$datey"_"$tijd"\:"$daten"_"$tijd"]
2. Or perhaps skip the : and use the word to including the use of some spaces.
3. Or perhaps the strings shouldn't be qouted but the : does need quotes?
If you can't fix it with a hammer, you've got an electrical problem!

Fibaro HC2, various z-wave switching, alerting, detection modules.
ELV FHT80b heating system.
User avatar
jrkalf
Member
Member
Posts: 291
Joined: Fri Nov 12, 2010 4:20 pm
Location: Nootdorp
Contact:

Re: gnuplot question

Post by jrkalf »

Code: Select all

############################
# Display the on and off values off an FS20 device
# Corresponding FileLog definition:
# define fs20log FileLog /var/log/fhem/fs20dev-%Y-%U.log fs20dev

set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<TL>'

set ytics ("Off" 0, "On" 1)
set y2tics ("Off" 0, "On" 1)
set yrange [-0.1:1.1]
set y2range [-0.1:1.1]
set ylabel "Position"
set y2label "Position"

#FileLog 3::0:$fld[2]eq"on"?1:0

plot "< awk '{print $1, $3==\"on\"? 1 : 0; }' <IN>"\
        using 1:2 notitle with steps
This is a simple paste from a gnuplot from the fs20.gplot file from the FHEM directory. From every example I see you can't use variables like that in the xrange or yrange.
Another thing that I noticed:

Code: Select all

#!/usr/bin/gnuplot

datey="`date +%Y-%m-%d --date='1 days ago'`"
tijd="`date +%H:%M:%S`"
daten="`date +%Y-%m-%d`"
set terminal png transparent small size 950,400 crop
set output '/var/www/temp/testje.png'
set xdata time
set timefmt '%Y-%m-%d_%H:%M:%S'
set xrange ["$datey"_"$tijd":"$daten"_"$tijd"]
Shouldn't this be:

Code: Select all

#!/usr/bin/gnuplot

set datey="`date +%Y-%m-%d --date='1 days ago'`"
set tijd="`date +%H:%M:%S`"
set daten="`date +%Y-%m-%d`"
set terminal png transparent small size 950,400 crop
set output '/var/www/temp/testje.png'
set xdata time
set timefmt '%Y-%m-%d_%H:%M:%S'
set xrange ["$datey"_"$tijd":"$daten"_"$tijd"]
you forgot to put "set " infront of the key variables you're trying to use.
If you can't fix it with a hammer, you've got an electrical problem!

Fibaro HC2, various z-wave switching, alerting, detection modules.
ELV FHT80b heating system.
User avatar
jrkalf
Member
Member
Posts: 291
Joined: Fri Nov 12, 2010 4:20 pm
Location: Nootdorp
Contact:

Re: gnuplot question

Post by jrkalf »

Any update Richard?

Did you get it working and what was the error?
If you can't fix it with a hammer, you've got an electrical problem!

Fibaro HC2, various z-wave switching, alerting, detection modules.
ELV FHT80b heating system.
Kroonen
Member
Member
Posts: 302
Joined: Mon Oct 01, 2007 6:38 pm
Location: Netherlands

Re: gnuplot question

Post by Kroonen »

Well now it works with this config

#!/usr/bin/gnuplot
datey="`date +%Y-%m-%d_%H:%M:%S --date='1 days ago'`"
daten="`date +%Y-%m-%d_%H:%M:%S`"
set terminal png size 350,100 x101010 x808080 xcd0000 xcd0000 x78a7fc tiny
set output '/var/www/temp/buitentemp.png'
set xdata time
set timefmt '%Y-%m-%d_%H:%M:%S'
set xrange [datey:daten]
set xlabel " "
set ytics nomirror
set format x "%a\n%H:%M%"
set border 0
set key off
set y2tics
set title 'Outside'
plot "< awk '/T:/ {print $1, $4}' /var/log/fhem/buiten-2011.log" using 1:2 axes x1y2 title 'Measured temperature' with lines lw 1, "< awk '/H:/ {print $1, $
Post Reply

Return to “Questions & Discussions Forum”