1
votes

I am plotting a graph with regular variables on the x and y axis and I want the line to change color with respect a time variable. I have tried using lc palette after defining one and even the colorbox appears but the line doesn't change color. I also tried with another column and it did change color so I asume it has to do with the timefmt. I am also using multiplot.

So, why doesnt lc palette work and how can I make it work?

This is my code:

set encoding iso_8859_1
set terminal postscript enhanced color "Times-Roman" 14 
set origin 0.05,0.05
set size 1,1

set output "ajustvarmod.eps"
set bmargin 2.5
set tmargin 3
set multiplot

set cbdata time  
set timefmt "%Y-%m-%d %H:%M:%S" #we tell how is the input time format
set cbrange ["2015-03-31 12:00:00":"2015-04-01 14:30:00"]

set format cb "%H:%M\n%m/%d"
set datafile separator ","
set datafile missing "NAN" #1.e+37
set origin 0.05,0.08
set size 0.5,0.5
set xlabel "m/s"
set ylabel "\260 C"
set palette rgb 33,13,10 
plot    "comparaciotermosexposats.txt" using ($20):($5-$3):($1) title "Wind : Hc2s3shaded-shield"  w lp lc palette

set origin 0.5,0.08
set size 0.5,0.5
set xlabel " RH (%)"
plot    "comparaciotermosexposats.txt" using ($19):(($5-$3)):($1) title "RH : Hc2s3shaded-shield"  w lp lc palette 

An example of the data I am using is:

"2015-03-31 12:40:00","2015-03-31 12:40:00", 24.03, 0.057, 24.87, 0.028, 24.57, 0.013, 24.75, 0.018, 24.88, 0.010, 24.88, 0.000, 24.77, 0.028, 24.80, 0.025, 39.77, 2.541, 0.560,582.8     
"2015-03-31 12:41:00","2015-03-31 12:41:00", 24.01, 0.031, 24.90, 0.060, 24.54, 0.071, 24.73, 0.091, 24.85, 0.095, 24.82, 0.106, 24.73, 0.099, 24.71, 0.121, 38.33, 3.011, 0.651,583.3     
"2015-03-31 12:42:00","2015-03-31 12:42:00", 23.85, 0.038, 24.68, 0.041, 24.39, 0.029, 24.47, 0.022, 24.59, 0.032, 24.54, 0.023, 24.43, 0.032, 24.44, 0.037, 44.64, 2.674, 0.486,583.8     
"2015-03-31 12:43:00","2015-03-31 12:43:00", 23.94, 0.049, 24.88, 0.058, 24.53, 0.031, 24.65, 0.040, 24.77, 0.042, 24.72, 0.036, 24.63, 0.050, 24.64, 0.038, 39.24, 2.916, 0.852,580.6     

Thank you in advance.

1

1 Answers

0
votes

$1 is the shortcut for column(1), which gives you the numerical value of the first column, not the parsed datetime.

Usually, for the x-axis one would only use 1 to have time data parsed if set xdata time is used. It seems like this doesn't work with time color data (at least not with 5.0). Using expicitely timecolumn(1) works here:

set encoding iso_8859_1
set cbdata time  
set timefmt '%Y-%m-%d %H:%M:%S' #we tell how is the input time format
set autoscale cbfix

set format cb "%H:%M\n%m/%d"
set datafile separator ","
set xlabel "m/s"
set ylabel "\260 C"
set palette rgb 33,13,10

set style data linespoints

set multiplot layout 1,2
plot    "comparaciotermosexposats.txt" using 20:($5-$3):(timecolumn(1)) title "Wind : Hc2s3shaded-shield" lc palette
set xlabel " RH (%)"
plot    "comparaciotermosexposats.txt" using 19:(($5-$3)):(timecolumn(1)) title "RH : Hc2s3shaded-shield" lc palette
unset multiplot

Note, that here I used set autoscale cbfix in order to see the effect with the four data points you provided. You also see, that you may get discrepancies between the line and point colors, because the line gets its color only from the second point, so that the first point and the following line may have different colors. If the color steps aren't too big, you won't notice that.

enter image description here