What I want to do is each polygone with number of points should be represented with a different color inside gnuplot
(data file looks like this) `
6.185000 8.219000
6.566000 4.724000
1.392000 7.538000
6.185000 8.219000
8.455000 5.243000
1.776000 5.401000
1.515000 5.455000
8.455000 5.243000
`
And my script.gpl `
set style line 1 \
linecolor rgb '#0060ad' \
linetype 1 linewidth 2 \
pointtype 7 pointsize 1.5
set style line 2 \
linecolor rgb '#dd181f' \
linetype 1 linewidth 2 \
pointtype 5 pointsize 1.5
set datafile separator "\t"
plot 'path\data.txt' index 0 with linespoints linestyle 1, \
'' index 1 with linespoints linestyle 2
`
the script above works only of each polygone has 2 or less points any number above and It shows me 'warning: Skipping data file with no valid points'
Short answer: you need 2 blank lines to separate subblocks which you want to address via index
.
Your script a bit shortened, and using spaces instead of TAB
as separator because I don't know how to post and format TABs
in StackOverflow.
Script:
### addressing subblocks via index
reset session
$Data <<EOD
6.185000 8.219000
6.566000 4.724000
1.392000 7.538000
6.185000 8.219000
8.455000 5.243000
1.776000 5.401000
1.515000 5.455000
8.455000 5.243000
EOD
set style line 1 lc rgb 0x0060ad lw 2 pt 7 ps 1.5
set style line 2 lc rgb 0xdd181f lw 2 pt 5 ps 1.5
set datafile separator whitespace
plot $Data u 1:2 index 0 w lp ls 1, \
'' u 1:2 index 1 w lp ls 2
### end of script
Result: