linux 终端 画圆,linux - 我如何在gnuplot绘图的每个点绘制一个圆? - SO中文参考 - www.soinside.com...

如果您真的想要圈子,以下可能是我想到的解决方案。但是也许您实际上想要绘制表面?为此,可能还有其他解决方案。

代码:### circles along datapoints

reset session

# create some 3D test data

set samples 50

set table $Data

plot [0:1.5] '+' u (cos(2*pi*$1)):(sin(2*pi*$1)):($1*10) w table

unset table

# define the circle

Radius = 0.1

set samples 24

set table $Circle

plot [0:1] '+' u (cos(2*pi*$1)):(sin(2*pi*$1)) w table

unset table

Offset(i,axis) = real(word($Data[i],axis))

set view 65,124

splot $Data u 1:2:3 w lp pt 7 lw 2 lc rgb "red", \

for [i=1:|$Data|] $Circle u ($1+Offset(i,1)):($2+Offset(i,2)):(Offset(i,3)) w l notitle

### end of code

结果:

eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9YS2N3My5wbmcifQ==

添加:

这里是一个稍微修改的版本(也许有一种更简单的实现方法),您在其中创建可以用表面绘制的数据块$Tube。圆仍平行于xy平面。虽然,我怀疑您实际上可能想使圆与输入数据路径的方向正交。

代码:### circle surface along datapoints

reset session

# create some test data

set samples 50

set table $Data

plot [0:1.5] '+' u (cos(2*pi*$1)):(sin(2*pi*$1)):($1*10) w table

unset table

# define the circle

Radius = 0.1

set samples 24

set table $Circle

plot [0:1] '+' u (cos(2*pi*$1)):(sin(2*pi*$1)) w table

unset table

D(i,axis) = real(word($Data[i],axis))

C(i,axis) = real(word($Circle[i],axis))

# generate "tube" datapoints

set print $Tube

do for [i=1:|$Circle|] {

do for [j=1:|$Data|] {

print sprintf("%.3f %.3f %.3f", C(i,1)+D(j,1), C(i,2)+D(j,2), D(j,3))

}

print "" # empty line

}

set print

set pm3d depthorder noborder

set pm3d lighting specular 0.5

set view 65,124

splot $Data u 1:2:3 w lp pt 7 lw 2 lc rgb "red", \

$Tube u 1:2:3 w pm3d notitle

### end of code

结果:

eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS9XckZYWi5wbmcifQ==

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值