Question

With the following simple data file

1 1 
2 3
3 4

and this script

set style line 2 lt 3 lc rgb "red" lw 3
show style line

set xrange [0:5]
set yrange [0:5]
plot "test_data.txt" u 1:2 ls 1

I don't see the line. Instead I only see the points. More than that, I don't see (1 1). Why? I followed the same steps form here

enter image description here

Was it helpful?

Solution

You have a data file, the example you reference uses functions. In gnuplot you need to specify that you want to use lines (with lines or in short w l) if you want to join data points with lines. Also, I can see (1 1) on your graph. Also I noticed you defined style line 2 but then used ls 1 instead of ls 2 to plot your data (that is you're not using the style you previously defined). Try

plot "test_data.txt" u 1:2 w l ls 2

If you also want to see the points together with lines, then use with linespoints or w lp:

plot "test_data.txt" u 1:2 w lp ls 2
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top