I have the following data:
1 2 3 4
1 2 3 4
1 2 4
1 2 4
If I use
plot "file" u 1:3
then it plots {1,3},{1,3},{1,4},{1,4}
How do I plot it following the column?
This is a txt file.
gnuplot's standard column separator is whitespace
and does not distinguish between a single space and multiple spaces. Check help datafile separator
.
If your column separator is strictly one and only one space you can simply
set datafile separator " "
.
However, then your data must look like this:
1 2.1 3.1 4.1
2 2.2 3.2 4.2
3 2.3 4.3 # two spaces but not more
4 2.4 4.4 # ditto
5 2.5 3.5 4.5
But since your data doesn't seem to look like this, you probably have to go for this workaround.
Nevertheless, here is the first option.
Script:
### empty columns
reset session
$Data <<EOD
1 2.1 3.1 4.1
2 2.2 3.2 4.2
3 2.3 4.3
4 2.4 4.4
5 2.5 3.5 4.5
EOD
set key out tmargin
set multiplot layout 1,2
set datafile separator whitespace # this is default
plot $Data u 1:2 w lp pt 7 lc "red", \
'' u 1:3 w lp pt 7 lc "green", \
'' u 1:4 w lp pt 7 lc "blue"
set datafile separator " "
plot $Data u 1:2 w lp pt 7 lc "red", \
'' u 1:3 w lp pt 7 lc "green", \
'' u 1:4 w lp pt 7 lc "blue"
unset multiplot
### end of script
Result: