|
From: Ethan A M. <eam...@gm...> - 2015-12-26 21:22:25
|
On Saturday, 26 December 2015 08:10:21 PM sfg...@gm... wrote: > Hi folks, > > I want to plot time series data where the color of a point depends on > the hour the data is measured (0 to 23 hour). But I can't figure out > how to do this. Here is my example: > > reset > set xlabel "Date" > set xdata time > set timefmt '"%Y-%m-%d %H:%M"' > set format x "%m-%d" > set xtics nomirror > set ylabel "Y" > set palette model RGB defined ( 0 'green', 23 'blue' ) > set cbrange [0:23] > > T(N) = tm_hour(timecolumn(N,'"%Y-%m-%d %H:%M"')) > > plot '-' u 1:2:T(1) with linespoints axis x1y1 title 'Y' ps 2 lw 2 palette > "2015-12-15 Tue 07:40" 2.4 > "2015-12-15 Tue 21:48" 1.7 > "2015-12-16 Wed 08:13" 2.5 > "2015-12-17 Thu 08:54" 2.6 > "2015-12-17 Thu 21:41" 2.2 > "2015-12-18 Fri 08:05" 2.1 > "2015-12-19 Sat 10:35" 3.6 > "2015-12-20 Sun 11:40" 3.6 > "2015-12-21 Mon 09:32" 4.5 > EOF > > I got "unknown type in magnitude()" error. Any hints how to resolve > this? Thanks, Sven There are several syntax errors there. I won't fix them all but here's a variant that works: H(N) = int(strcol(N)[16:*]) plot '-' u 1:2:(H(1)) with linespoints title 'Y' ps 2 lw 2 lc palette |