I'm trying to change the plotting style based on an entry in a data-file.
I have a large data-file with every third column being an x-position and a y-position and a colour identifier, as such:
x-position|y-position|colour|x-position|y-position|colour|...
and i would like to plot the first 5 data-points, and tried:
plot for [i = 1:9:3] 'SIR_data.txt' every::0::5 using i:i+1 with lines lt i+2 notitle
and every entry in the colour-columns, is 2. but the plot i got was: The plot as produced by the code above how do i plot with linestyle based on the entry of the colour-column? Thanks.
To plot points with
column 1 = x
column 2 = y
column 3 = linetype
the command would be
plot "file" using 1:2:3 with points lc variable
It is not obvious how you want to extend this to plot style with lines
. Does the first color entry control the whole line? Does each segment of the line get a separate color? To plot the first five rows of a file using both points and lines that change color for each segment
plot "file" using 1:2:3 every 1::1::5 with linespoints lc variable
Example shown below (but I think it looks rather strange). As you can see, each line segment gets the color that corresponds to the endpoint color value.
Gnuplot is not designed to pull multiple successive points from a single line in the input file. If you only needed points (not lines) then you could catch them all by using multiple plot clauses:
plot for [k=1:N:3] "file" using k:k+1:k+2 with points lc variable
However this would be plotting them in the order (first three columns), (second three columns), ... rather than (all point on line one), (all points on line two), ... For points it comes out the same either way, but for lines these are two diferent things.