Gnuplot lc 调色板不适用于 timefmt
Gnuplot lc palette not working with timefmt
我正在用 x 轴和 y 轴上的常规变量绘制图表,我希望线条根据时间变量改变颜色。我在定义一个调色板后尝试使用 lc 调色板,甚至出现了颜色框,但线条没有改变颜色。我还尝试了另一列,它确实改变了颜色,所以我认为它与 timefmt 有关。我也在使用多图。
那么,为什么 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 "0 C"
set palette rgb 33,13,10
plot "comparaciotermosexposats.txt" using ():(-):() 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 ():((-)):() 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
提前致谢。
</code> 是 <code>column(1)
的快捷方式,它为您提供第一列的数值,而不是解析的日期时间。
通常,对于 x 轴,如果使用 set xdata time
,则只会使用 1
来解析时间数据。这似乎不适用于时间颜色数据(至少不适用于 5.0)。在这里明确使用 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 "0 C"
set palette rgb 33,13,10
set style data linespoints
set multiplot layout 1,2
plot "comparaciotermosexposats.txt" using 20:(-):(timecolumn(1)) title "Wind : Hc2s3shaded-shield" lc palette
set xlabel " RH (%)"
plot "comparaciotermosexposats.txt" using 19:((-)):(timecolumn(1)) title "RH : Hc2s3shaded-shield" lc palette
unset multiplot
请注意,我在这里使用了 set autoscale cbfix
以查看您提供的四个数据点的效果。您还会看到,线和点的颜色可能存在差异,因为线的颜色仅来自第二个点,因此第一个点和下一条线可能具有不同的颜色。如果颜色阶梯不是太大,您将不会注意到。
我正在用 x 轴和 y 轴上的常规变量绘制图表,我希望线条根据时间变量改变颜色。我在定义一个调色板后尝试使用 lc 调色板,甚至出现了颜色框,但线条没有改变颜色。我还尝试了另一列,它确实改变了颜色,所以我认为它与 timefmt 有关。我也在使用多图。
那么,为什么 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 "0 C"
set palette rgb 33,13,10
plot "comparaciotermosexposats.txt" using ():(-):() 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 ():((-)):() 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
提前致谢。
</code> 是 <code>column(1)
的快捷方式,它为您提供第一列的数值,而不是解析的日期时间。
通常,对于 x 轴,如果使用 set xdata time
,则只会使用 1
来解析时间数据。这似乎不适用于时间颜色数据(至少不适用于 5.0)。在这里明确使用 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 "0 C"
set palette rgb 33,13,10
set style data linespoints
set multiplot layout 1,2
plot "comparaciotermosexposats.txt" using 20:(-):(timecolumn(1)) title "Wind : Hc2s3shaded-shield" lc palette
set xlabel " RH (%)"
plot "comparaciotermosexposats.txt" using 19:((-)):(timecolumn(1)) title "RH : Hc2s3shaded-shield" lc palette
unset multiplot
请注意,我在这里使用了 set autoscale cbfix
以查看您提供的四个数据点的效果。您还会看到,线和点的颜色可能存在差异,因为线的颜色仅来自第二个点,因此第一个点和下一条线可能具有不同的颜色。如果颜色阶梯不是太大,您将不会注意到。