How do you draw a circle using GNUplot?

Viewed 1379

I'd like to draw a circle with a 0.06 diameter using GNU plot. I've been searching for a while and can't find any solution. Just a simple circle that will act as an indicator for points to be plotted after if it goes out pf bounds that specific circle.

I need something like this but the diameter would be -0.06 to 0.06.

enter image description here

Here's the code for the sample image:

gnuplot> set parametric

    dummy variable is t for curves, u/v for surfaces
gnuplot> set size square
gnuplot> set xrange [-1:1]
gnuplot> set yrange [-1:1]
gnuplot> plot [0:2*pi] sin(t),cos(t)
2 Answers

Using an object is the good solution, but just as an addition:

The parametric equation of a circle centered on the origin is simply:

(x(t) = r.cos(t), y(t) = r.sin(t))

Where r is the radius of the circle and t the parameter.

So for a circle of radius 0.6, simply type:

set parametric
set size square
set xrange [-1:1]
set yrange [-1:1]
plot [0:2*pi] 0.6*sin(t), 0.6*cos(t)

result

Done using this code:

set terminal png size 1000,1000; 
set output 'test.png';
set xrange [-0.06:0.06]
set yrange [-0.06:0.06]
set size square
set object 1 circle front at 0,0size 0.06 fillcolor rgb "black" lw 1
plot "data.txt", "data2.txt"

Thank you @Christoph for pointing me to the right direction.

Related