SrD4443
SrD4443

Reputation: 1

How to plot linepoint in gnuplot such that the lines shouldn't pass through the points and points should be open squares or triangles(not solid)

I want to plot a linepoint plot where I need the line not to pass through the points. When the points are solid, whether the line passes through or not, it doesnot matter. But when the point-types are open, it does not look good.

I have tried with open circle using a trick and it worked. I am sharing the code below.

 set style circle radius 0.007
plot 'data1.dat' u 1:(($3)**2) w l lw 4 lc "blue" notitle,\
'data1.dat' u 1:(($3)**2) with circle fillcolor "cyan" fs solid 0.2 border linecolor "blue" notitle

Now I am trying to use square, triangle and other shapes as point type but I am not sure what command to give for those.

For square, I have tried using the command:

 set size square

 plot 'data1.dat' u 1:2:(0.001):(0.014) with boxxy fillcolor "red" fs solid 1.0 border linecolor "red" notitle

But here trhe problem is the size of the box are not fixed and varies as per range of x and y-axis. It even gets worse when the axis is set to logarithmic scale.

I would appreciate any good solution.

Upvotes: 0

Views: 56

Answers (1)

theozh
theozh

Reputation: 26123

You are probably looking for pointintervalbox, check help pointintervalbox and help pointinterval.

Script:

### linespoint without lines through points
reset session

set samples 11
set pointintervalbox 1.6
set key top left

plot '+' u 1:($1+16) w lp pt 4 ps 2       ti "square", \
      '' u 1:($1+14) w lp pt 6 ps 2       ti "circle", \
      '' u 1:($1+12) w lp pt 8 ps 2       ti "triangle", \
      '' u 1:($1+ 6) w lp pt 4 ps 2 pi -1 ti "square", \
      '' u 1:($1+ 4) w lp pt 6 ps 2 pi -1 ti "circle", \
      '' u 1:($1+ 2) w lp pt 8 ps 2 pi -1 ti "triangle", \
### end of script

Result:

enter image description here

Upvotes: 1

Related Questions