如何使用GNUplot绘制圆?
我想用GNU图画一个直径为0.06的圆。我已经搜索了一段时间,找不到任何解决方案。只要一个简单的圆,当它超出特定圆的边界时,它就可以作为要绘制点的指示器 我需要这样的东西,但是直径应该是-0.06到0.06 以下是示例图像的代码:如何使用GNUplot绘制圆?,gnuplot,Gnuplot,我想用GNU图画一个直径为0.06的圆。我已经搜索了一段时间,找不到任何解决方案。只要一个简单的圆,当它超出特定圆的边界时,它就可以作为要绘制点的指示器 我需要这样的东西,但是直径应该是-0.06到0.06 以下是示例图像的代码: gnuplot> set parametric dummy variable is t for curves, u/v for surfaces gnuplot> set size square gnuplot> set xrange [
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)
使用此代码完成:
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"
感谢@Christoph为我指明了正确的方向。使用对象是一个很好的解决方案,但只是作为一个补充:
以原点为中心的圆的参数方程为:
(x(t)=r.cos(t),y(t)=r.sin(t))
其中r是圆的半径,t是参数
因此,对于半径为0.6的圆,只需键入:
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)
设置对象圆
,@Christoph我无法让它工作,没有圆出现。