Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gnuplot: arc circles with no line

Tags:

gnuplot

I am trying to plot an arc segment using Gnuplot this circle command:

set obj 1 circle at 9 size 3 arc [0:180] fc rgb "blue" lw 1

And I'm getting Image

But I would like to get Modified

Is there a simple way to do that? Or do I need to draw the arc and then "erase" the part I don't need?

like image 229
Rafael Martinelli Avatar asked Nov 08 '25 00:11

Rafael Martinelli


2 Answers

Just for the records. Actually, since gnuplot 5.0.0 (Jan. 2015) there seems to be the option {no{wedge}}, however, not documented in help circle. It seems to appear the first time in help circle in gnuplot 5.2.7 (May 2019).

Script: (works with gnuplot>=5.0.0, Jan. 2015)

### circle/arc object with/without wedge
reset session

set obj 1 circle at -4,60  size 3 arc [0:180] fc "red"
set obj 2 circle at  4,60  size 3 arc [0:180] fc "web-green" nowedge

plot x**2
### end of script

Result:

enter image description here

like image 158
theozh Avatar answered Nov 11 '25 18:11

theozh


I was looking for the same function, but it seems that gnuplot doesn't support such features. Moreover, sometimes you need to plot such an arc using a non-polar plot and that doesn't make your life easier. Nevertheless, gnuplot allows you to do some tricks.

You can always set an arc and use any pair of angles you need. Next, you simply reverse the order of angles so that your initial one becomes your final and vice versa. Also, the colour has to be white.

set object 2 circle at 1.5, 0.8 arc [-90:90] size 1 fc rgb "black" lw 4 
set object 3 circle at 1.5, 0.8 arc [90:-90] size 1 fc rgb "white" lw 4

In addition, when you work with vectorized images, it's better to make the second arc a bit thicker, say, lw 5, otherwise some minor artefacts are observed.

Result

like image 21
Bracula Avatar answered Nov 11 '25 17:11

Bracula



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!