在一个点周围绘制一个半径为R的圆

时间:2012-06-21 12:20:38

标签: gnuplot geometry

我正在使用gnuplot,我想知道是否可以在给定点(x,y)周围绘制一个半径为R的圆?

3 个答案:

答案 0 :(得分:12)

如果您不想绘制圆形图,可以使用set object circle命令。你可以像这样使用它,例如:

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

这将在原点处绘制一个海军蓝色圆圈,半径为屏幕(画布)大小的0.1。请注意,当您指定圆的位置/半径时,您必须指定所使用的坐标系:first对应于第一个xy坐标系,scrscreen的缩写)用于屏幕坐标。您可以通过查看绘图圈子的文档来了解更多信息。

答案 1 :(得分:0)

正在运行的gnuplot脚本:

# tell gnuplot where we want to look at
set xrange [0:1]
set yrange [0:1]

# make a square plot
set size square

# create a black circle at center (0.5, 0.5) with radius 0.5
set object 1 circle front at 0.5,0.5 size 0.5 fillcolor rgb "black" lw 1

f(x) = x # we need to plot at lest one function
plot f(x) # show the stuff

答案 2 :(得分:0)

  

现在,如果我有很多点(在txt文件中,每行是x y),并且我想绘制一个圆,每个圆的指定半径不同。我应该为每个点i重复命令“将对象i设置为Xi,Yi大小的第一个Ri fc rgb“海军”圈吗?

答案:不! gnuplot V4.4(2010)中提供了对with circles的绘制。

"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

代码:

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

结果 :(使用gnuplot 4.4创建)

enter image description here

相关问题