Search code examples
3dgnuplotcylindrical

plot cylindrical coordinate using an x y file in gnuplot


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) 2D section

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]. enter image description here 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 !


Solution

  • 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:

    enter image description here