pAndrei
pAndrei

Reputation: 383

gnuplot incomplete graphic

I want to plot this data table called quad.dat

#size  time unoptimized blas optimized
2000        0.038101        0.012038        0.012070
4000        0.153213        0.031582        0.048172
6000        0.344972        0.058697        0.108295
8000        0.616240        0.110157        0.192449
10000       0.957405        0.159003        0.300352
12000       1.378795        0.232613        0.431949
14000       1.877082        0.312295        0.587642
16000       2.451135        0.398170        0.766826
18000       4.364723        0.508351        0.970915
20000       5.480937        0.625813        1.197483
22000       6.593878        0.760008        1.448211
24000       7.757721        0.902324        1.714848
26000       9.107044        1.051169        2.018033

This is my gnuplot script:

set ylabel "Time [s]"
set xlabel "matrix size[ in k(1000)]"
set xrange [0:26]
set yrange [0:15]
plot "quad.dat" using 2 title "unoptimized" with lines, \
     "quad.dat" using 3 title "blas" with lines,\
     "quad.dat" using 4 title 'optimized' with lines
pause -1

Here is what the actual plot looks like:

demo-plot

As you can see, not all points are plotted and I can't understand why, it seems to stop at something like 12k.

Upvotes: 0

Views: 211

Answers (1)

mgilson
mgilson

Reputation: 309949

when you only give using a single column to plot, gnuplot assumes those are the y values and the x values are filled in using consecutive integers. This isn't what you want (If it stops at 12, that means you have 12 data points in the file).

You actually wan to tell gnuplot the x values explicitly:

plot "quad.dat" using ($1/1000.):2 title "unoptimized" with lines,\
     "quad.dat" using ($1/1000.):3 title "blas" with lines,\
     "quad.dat" using ($1/1000.):4 title 'optimized' with lines

(This divides the number in the first column by 1000 to be consistent with the x-label).

Upvotes: 1

Related Questions