Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotting curves with different point styles in Gnuplot

Tags:

gnuplot

I'm using Gnuplot to draw a graph. In the graph I drew three smooth curve belonging to three data sets.

Presently I'm using the following Gnuplot script.

reset
set terminal png
set xlabel "Square matrix size"

set ylabel "Time (in milliseconds)"
set yrange [0:750]

set title "Lower Triangular Matrix"
set key reverse Left outside
set grid
set output 'matrixlt.png'
set style data linespoints
plot "matrixlowertriangle.dat" using 1:2 lt 1 lw 2 smooth bezier title 'MatPro', \
     "matrixlowertriangle.dat" using 1:3 lt 2 lw 2 smooth bezier title 'C#' , \
     "matrixlowertriangle.dat" using 1:4 lt 3 lw 2 smooth bezier title 'C++'

With the above script I'm getting following graph. enter image description here

Now I want to draw each point belonging to the same curve using a unique point style. ( For example each point belonging to C# using one point type and C++ data points in a different style.)

I tried some tutorials, but still no luck. Can somebody help me to achieve this task?

like image 620
Upul Bandara Avatar asked Jan 19 '23 06:01

Upul Bandara


1 Answers

I don't have your data so I made some up (it always helps to be helpful if some useful mock dataset is given...):

0   0   0   0
200 1000    1200    1500
400 4000    7000    9000
600 7000    15000   18000
800 12000   23000   25000
1000    18000   33000   40000

Based upon your code, I tried

reset
set terminal png
set xlabel "Square matrix size"

set ylabel "Time (in milliseconds)"
set xrange [0:1200]
set yrange [0:50000]


set title "Lower Triangular Matrix"
set key reverse Left outside
set grid
set output 'matrixlt.png'
set style data linespoints
plot "matrixlowertriangle.dat" using 1:2 lt 1 lw 2 smooth bezier title 'MatPro', \
     "matrixlowertriangle.dat" using 1:3 lt 2 lw 2 smooth bezier title 'C#' , \
     "matrixlowertriangle.dat" using 1:4 lt 3 lw 2 smooth bezier title 'C++' , \
     "matrixlowertriangle.dat" using 1:2 with points title "", \
     "matrixlowertriangle.dat" using 1:3 with points title "", \
     "matrixlowertriangle.dat" using 1:4 with points title ""

and got

this graph here

Is that closer to what you want?

like image 105
vaettchen Avatar answered Jan 20 '23 20:01

vaettchen