How to draw a rectangle with a colored border in gnuplot

esperluette picture esperluette · Aug 20, 2014 · Viewed 15.2k times · Source

I would like to draw an empty rectangle in my plot.

So far I have:

set style rect back fs empty border lt 3 
set object 1 rect from 1,1 to 2,2 

And I have my rectangle with a dashed line. How do I change the color of the line? lc does not seem to work after border. I also tried with setting a new line style, and border but I was not successful.

Thank you!

Answer

Christoph picture Christoph · Aug 20, 2014

Using lc instead of lt in the code you posted works fine with version 4.6.5:

reset
set style rect back fs empty border lc rgb '#008800'
set object 1 rect from 1,1 to 2,2 lw 5
set object 2 rect from 1,3 to 2,4 lw 5 fs empty border lc rgb '#880088'
plot x

enter image description here

In any case (both with lt 3 and lc ...) the rectangle borders are solid. I tried the wxt, pngcairo, pdfcairo and postscript terminals and set the dashed option every time.