Reputation: 351
I would like to make a 3D plot with gnuplot using the interface.txt file (File).
Knowing that I have a y-axis rotation invariance.
This figure represents a 2D section (plot 'interface.txt' u 2:1)
Here's what I'd like to have with gnuplot but I don't know how to plot it.
I would like to get this picture but for theta = [0:2*pi].
I tried this code but for now i don't know how to plot it
reset
set angles degrees
set mapping cylindrical
splot for [t=1:360:2] 'interface.txt' u t:1:(sqrt($2**2+$1**2))
If you have any idea ? Thanks you !
Upvotes: 0
Views: 442
Reputation: 351
Thanks you, it is almost perfect.
Now it try to close my 2 surfaces.
So we need to link the edge of the curve to get one body. For that I use stats :
And then the final code :
### 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
Upvotes: 0
Reputation: 26198
I'm not sure whether the example below satisfies your expectations.
Since your original curve is not closed, this is not a body but a surface.
For pm3d
to do the "connections" between the rotated curves, I guess you have to have add a single empty line between the rotated curves. You can get this with the "trick" of plotting a dummy array with one element: plot A u ("") w table
. I hope that there are better solutions.
Code:
### 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
Result:
Upvotes: 1