我想使用interface.txt文件(File)用gnuplot制作3D图。知道我有y轴旋转不变性。该图表示2D区域(图'interface.txt'u 2:1)
这是我想要使用gnuplot拥有的内容,但我不知道如何绘制它。我想得到这张照片,但是theta = [0:2 * pi]。我尝试了这段代码,但现在我不知道如何绘制它
reset
set angles degrees
set mapping cylindrical
splot for [t=1:360:2] 'interface.txt' u t:1:(sqrt($2**2+$1**2))
[您有什么想法吗?谢谢!
我不确定下面的示例是否满足您的期望。由于原始曲线未闭合,因此它不是物体而是曲面。为了使pm3d
执行旋转曲线之间的“连接”,我想您必须在旋转曲线之间添加一条空线。您可以通过绘制带有一个元素plot A u ("") w table
的虚拟数组的“技巧”来获得此效果。我希望有更好的解决方案。
代码:
### rotation of a curve
reset session
set angle degrees
set table $Rotation
array A[1] # dummy array for plotting a single empty line
do for [i=0:360:15] {
plot "interface.txt" u ($2*cos(i)):($2*sin(i)):1 w table
plot A u ("") w table
}
unset table
set pm3d hidden3d depthorder
# set view equal xyz # uncomment to have equal x,y,z scales
set view 30,50,1.3 # scale 1.3 to reduce white space around
splot $Rotation u 1:2:3 w pm3d lt -2 notitle
### end of code
结果:
因此,我们需要链接曲线的边缘以获得一个实体。为此,我使用stats:
然后是最终代码:
### rotation of a curve
reset session
set print $interface
stats 'interface.txt' nooutput
print sprintf("%g %g", STATS_max_y, STATS_pos_max_y)
print sprintf("%g %g", STATS_max_y, -STATS_pos_max_y)
set angle degrees
set table $Rotation
array A[1] # dummy array for plotting a single empty line
do for [i=0:360:10] {
plot "interface.txt" u ($2*cos(i)):($2*sin(i)):1 w table
plot "interface.txt" u ($2*cos(i)):($2*sin(i)):(-$1) w table
plot $interface u ($1*cos(i)):($1*sin(i)):2 w table
plot A u ("") w table
}
unset table
unset key
set border
set style fill solid 1.00 border -1
set view 62, 8, 1.245, 1.0
set ticslevel 0
set pm3d depthorder interpolate 4,4 lighting specular 0.6 at s
# set view equal xyz # uncomment to have equal x,y,z scales
splot $Rotation u 1:2:3 w pm3d lt -2 notitle
### end of code