我正在使用gnuplot,想知道是否可以在给定点(x,y)周围画一个半径为R的圆?
如果您不想绘制圆形图,可以使用set object circle
命令。例如,您可以像这样使用它:
set object X circle at axis 0,0 size scr 0.1 fc rgb "navy"
这将在原点处绘制一个半径为屏幕(画布)大小的0.1的深蓝色圆。请注意,当您指定圆的位置/半径时,必须指定使用的坐标系:first
对应于第一个x-y坐标系统,scr
(缩写为screen
)是用于屏幕坐标。您可以通过查看绘制圆的文档了解更多内容。
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创建)
工作中的 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
set size ratio -1
,因为 gnuplot 会绘制一个圆,而不管图的纵横比如何。 - mgilson