0

I'm plotting point using Gnuplot as explained in this article. For example:

point plot example

However I want to draw a black border around each of the points. In the above example, the square, circle, and triangle should have a black outline.

My line definitions look like this:

set style line 1 linecolor rgb '#ebac23' pointtype 5 pointsize 2

But these definitions do not seem to take a border option. What is the correct way of accomplishing this?

1

I did not find a border option. As a workaround, you could plot the points twice. The first time with black shapes and the second time with slightly smaller shapes of the colour you want.

unset key

set xrange [0.6:3.4]
set yrange [0:3]

# Square
set style line 1 linecolor rgb '#000000' pointtype 5 pointsize 3
set style line 2 linecolor rgb '#ebac23' pointtype 5 pointsize 2

# Circle
set style line 3 linecolor rgb '#000000' pointtype 7 pointsize 3
set style line 4 linecolor rgb '#ebac23' pointtype 7 pointsize 2

# Triangle
set style line 5 linecolor rgb '#000000' pointtype 9 pointsize 3
set style line 6 linecolor rgb '#ebac23' pointtype 9 pointsize 2

plot "<echo '1 2'"   with points ls 1, \
     ""              with points ls 2, \
     "<echo '2 1'"   with points ls 3, \
     ""              with points ls 4, \
     "<echo '3 1.5'" with points ls 5, \
     ""              with points ls 6

enter image description here

Unfortunately, the triangle doesn't look quite right. It seems the centre of the two triangles are not perfectly aligned. Still, maybe this is good enough. If not, you could try the diamond or pentagon shapes since they both look better.

0

You can "misuse" boxxyerrorbars for this, but you will need to repeat the data. In the following I have repeated the data just as one block. boxxyerrorbars needs 4 numbers, the x,y position and a width and height. These need to be chosen to match the data scale in each direction.

set xrange [0:3.5]
set yrange [0:3]
set style line 1 linecolor rgb 'blue' pointtype 5 pointsize 2
set style line 2 linecolor rgb 'blue' pointtype 7 pointsize 2
set style line 3 linecolor rgb 'blue' pointtype 9 pointsize 2
plot '-' w p ls 1 notitle, \
 '-' w p ls 2 notitle,  \
 '-' w p ls 3 notitle, \
 '-' using 1:2:(.08):(.1) with boxxyerrorbars black notitle
1 2
e
2 1
e
3 1.5
e
1 2
2 1
3 1.5
e

gnuplot image

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.