Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

drawing a circle of radius R around a point

I'm using gnuplot, and I wonder if it is possible to draw a circle of radius R around a given point (x,y) ?

like image 796
shn Avatar asked Jun 21 '12 12:06

shn


People also ask

Which command helps to draw a circle with radius r?

Answer. Answer: The circle command is used to draw a circle by specifying the center point and radius.


2 Answers

If you don't want to graph a circle, you can use the set object circle command. You use it like this, for example:

set object X circle at axis 0,0 size scr 0.1 fc rgb "navy"

This will draw a navy blue circle at the origin with a radius of 0.1 of the screen (canvas) size. Note that when you specify a position/radius for the circle you have to specify which coordinate system you are using: first corresponds to the first x-y coordinate system, scr (short for screen) is for screen coordinates. You can learn more by looking in the documentation for drawing circles.

like image 198
andyras Avatar answered Sep 17 '22 13:09

andyras


Now if I have many points (in a txt file where each line is x y) and I want to draw a circles which different specified radius for each point. Should I repeat the command "set object i circle at Xi,Yi size first Ri fc rgb "navy"" for each point i ?!

Answer: No! Plotting with circles was available in gnuplot V4.4 (2010).

"Circles.dat"

1 1 0.1
2 2 0.2
3 3 0.3
4 4 0.4
5 5 0.5
6 6 0.6

Code:

plot "Circles.dat" u 1:2:3:1 w circles lc var notitle

Result: (created with gnuplot 4.4)

enter image description here

like image 30
theozh Avatar answered Sep 20 '22 13:09

theozh