I have the following script:
$DATA<<EOD
0.800,New York City,8008,8175,red,1,9175,1
1.000,New York City,8008,8175,red,1,9175,1
1.200,New York City,8008,8175,red,1,9175,1
1.800,Los Angeles,3694,3792,green,2,4792,2
2.000,Los Angeles,3694,3792,green,2,4792,2
2.200,Los Angeles,3694,3792,green,2,4792,2
2.800,Chicago,2896,2695,blue,3,3695,3
3.000,Chicago,2896,2695,blue,3,3695,3
3.200,Chicago,2896,2695,blue,3,3695,3
3.800,Houston,1953,2099,orange,4,3099,4
4.000,Houston,1953,2099,orange,4,3099,4
4.200,Houston,1953,2099,orange,4,3099,4
4.800,Philadelphia,1517,1526,yellow,5,2526,5
5.000,Philadelphia,1517,1526,yellow,5,2526,5
5.200,Philadelphia,1517,1526,yellow,5,2526,5
EOD
set datafile separator comma
set style data line
set term windows
set grid xtics back
set grid noytics
unset xtics; unset ytics; unset x2tics; unset y2tics
set xtics nomirror; set ytics nomirror
set border 15.00000
set colorsequence default
set style textbox 1 opaque fc rgb "0x05472A" border lc rgb "0xFF0000" lw 2 margins 3,4
set style textbox 2 transparent noborder margins 1,2
set style textbox 3 opaque fc rgb "0xFFFF31" noborder
set title "{/Tahoma:Bold=22 Title}" rotate by 0
set xlabel "Cities"
set ylabel "Population (Millions)"
set key inside top right title "This is my Title" textcolor rgb "0x4B0082"
set xrange [0:6]
set xtics ("New York City" 1,"Los Angeles" 2,"Chicago" 3,"Houston" 4,"Philadelphia" 5)
plot $DATA every :3::0::15 using 1:3 lt 1 title "2000 Population",\
$DATA every :3::0::15 using 1:3:3 with labels offset 0,1.5 notitle
and I get the following chart: enter image description here
gnuplot is only readying the 3rd column from the $DATA (which is good), but it is reading all the rows from the $DATA (which is not good).
I am trying to use to "every" command to tell gnuplot to only plot every 3rd row starting with the first row (0); meaning, draw a line from 0.800,8008 to 1.800,3694 to 2.8,2896 to 3.8,1953 to 4.8,1517, but I am not getting what I want.
I have played with the column values in the every command but I either get an error message, no data plotted or the same result.
Later on I will put other two plot commands to draw the lines for the remaining rows, but I am getting stuck on the first set of rows.
What am I doing wrong?
Have you read help every
carefully?
Syntax:
plot 'file' every {<point_incr>}
{:{<block_incr>}
{:{<start_point>}
{:{<start_block>}
{:{<end_point>}
{:<end_block>}}}}}
This would mean, for plotting every 3rd row starting from row 0,1 and 2, respectively:
plot $DATA every 3::0 u 1:3:3 w labels, \
'' every 3::1 u 1:3:3 w labels, \
'' every 3::2 u 1:3:3 w labels