Gnuplot lc调色板不能与timefmt一起使用

时间:2015-05-09 18:57:40

标签: timestamp gnuplot palette

我正在使用x和y轴上的常规变量绘制图形,并且我希望线条相对于时间变量更改颜色。我在定义一个之后尝试使用lc调色板,甚至出现了颜色框,但线条没有改变颜色。我也尝试了另一个专栏,它确实改变了颜色,所以我认为它与timefmt有关。我也在使用multiplot。

那么,为什么lc调色板不起作用,我怎样才能使它工作?

这是我的代码:

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 

我正在使用的数据示例如下:

"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     

提前谢谢。

1 个答案:

答案 0 :(得分:0)

$1column(1)的快捷方式,它为您提供第一列的数值,而不是已解析的日期时间。

通常,对于x轴,如果使用1,则只使用set xdata time来解析时间数据。这似乎不适用于时间颜色数据(至少不是5.0)。使用expicitely timecolumn(1)在这里工作:

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

注意,我在这里使用set autoscale cbfix来查看您提供的四个数据点的效果。您还会看到,线条和点颜色之间可能会出现差异,因为线条仅从第二个点获得颜色,因此第一个点和后一个线条可能具有不同的颜色。如果颜色步长不是太大,你就不会注意到它。

enter image description here