Building curves with different point styles in Gnuplot

I use Gnuplot to draw a graph. On the graph, I drew three smooth curves belonging to three data sets.

I am currently 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 get the following graph. enter image description here

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

I tried some tutorials, but I still had no luck. Can someone help me achieve this?

+4
source share
3 answers

I have no data, so I made some of them (this always helps to be useful if some useful data set 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 on 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 received

this graph here

Is it closer to what you need?

+7
source

Have you tried providing pointtype X (where X is the number) to the plot arguments?

+2
source

I think your problem is using the PNG terminal. Do you need to use PNG format? If you try set terminal postscript enhanced eps color , the script creates numbers with clearly distinguishable line types.

For example, run the following simple script:

 set terminal postscript enhanced eps color set yrange [0:10] set grid set output 'test.eps' set title 'EPS demonstration' set style data linespoints plot x*2 lt 1 lw 2 title 'A', \ x**2 lt 2 lw 2 title 'B' 

gives two lines with different types of lines.

0
source

Source: https://habr.com/ru/post/1381904/


All Articles