15

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

4

3 回答 3

14

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

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

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

于 2012-06-21T13:28:26.787 回答
5

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

回答:不!绘图with circles在 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

代码:

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

结果:(使用 gnuplot 4.4 创建)

在此处输入图像描述

于 2019-11-08T19:13:26.863 回答
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
于 2019-11-08T03:57:47.687 回答