Drawing closed 3d path with pgfplots











up vote
1
down vote

favorite












I'd like to reproduce the following 3d image using pgfplots enter image description here



the battery doesn't need to be there, just the closed path and the axis.



I haven't been able to find any examples of 3d paths that are not expressible as parametric functions, but that are user-defined, seemingly random paths. Any idea on how to achieve this?










share|improve this question
























  • Please, could you add a minimal working example? Did you tried something?
    – Sebastiano
    2 days ago










  • I didn't add a MWE because, well, there wasn't. I mean, basically the only part of the image i want to replicate is the 3d path, which is what I don't know how to do.
    – Riccardo Mazzarini
    2 days ago






  • 2




    Why pgfplots and not tikz-3dplot?
    – marmot
    2 days ago










  • Well I used pgfplots for all the other images in the document I'm working on, but if the end result is similar in style, then tikz-3dplot will be fine, too.
    – Riccardo Mazzarini
    2 days ago















up vote
1
down vote

favorite












I'd like to reproduce the following 3d image using pgfplots enter image description here



the battery doesn't need to be there, just the closed path and the axis.



I haven't been able to find any examples of 3d paths that are not expressible as parametric functions, but that are user-defined, seemingly random paths. Any idea on how to achieve this?










share|improve this question
























  • Please, could you add a minimal working example? Did you tried something?
    – Sebastiano
    2 days ago










  • I didn't add a MWE because, well, there wasn't. I mean, basically the only part of the image i want to replicate is the 3d path, which is what I don't know how to do.
    – Riccardo Mazzarini
    2 days ago






  • 2




    Why pgfplots and not tikz-3dplot?
    – marmot
    2 days ago










  • Well I used pgfplots for all the other images in the document I'm working on, but if the end result is similar in style, then tikz-3dplot will be fine, too.
    – Riccardo Mazzarini
    2 days ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'd like to reproduce the following 3d image using pgfplots enter image description here



the battery doesn't need to be there, just the closed path and the axis.



I haven't been able to find any examples of 3d paths that are not expressible as parametric functions, but that are user-defined, seemingly random paths. Any idea on how to achieve this?










share|improve this question















I'd like to reproduce the following 3d image using pgfplots enter image description here



the battery doesn't need to be there, just the closed path and the axis.



I haven't been able to find any examples of 3d paths that are not expressible as parametric functions, but that are user-defined, seemingly random paths. Any idea on how to achieve this?







tikz-pgf 3d






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago









Stefan Pinnow

19.2k83172




19.2k83172










asked 2 days ago









Riccardo Mazzarini

162




162












  • Please, could you add a minimal working example? Did you tried something?
    – Sebastiano
    2 days ago










  • I didn't add a MWE because, well, there wasn't. I mean, basically the only part of the image i want to replicate is the 3d path, which is what I don't know how to do.
    – Riccardo Mazzarini
    2 days ago






  • 2




    Why pgfplots and not tikz-3dplot?
    – marmot
    2 days ago










  • Well I used pgfplots for all the other images in the document I'm working on, but if the end result is similar in style, then tikz-3dplot will be fine, too.
    – Riccardo Mazzarini
    2 days ago


















  • Please, could you add a minimal working example? Did you tried something?
    – Sebastiano
    2 days ago










  • I didn't add a MWE because, well, there wasn't. I mean, basically the only part of the image i want to replicate is the 3d path, which is what I don't know how to do.
    – Riccardo Mazzarini
    2 days ago






  • 2




    Why pgfplots and not tikz-3dplot?
    – marmot
    2 days ago










  • Well I used pgfplots for all the other images in the document I'm working on, but if the end result is similar in style, then tikz-3dplot will be fine, too.
    – Riccardo Mazzarini
    2 days ago
















Please, could you add a minimal working example? Did you tried something?
– Sebastiano
2 days ago




Please, could you add a minimal working example? Did you tried something?
– Sebastiano
2 days ago












I didn't add a MWE because, well, there wasn't. I mean, basically the only part of the image i want to replicate is the 3d path, which is what I don't know how to do.
– Riccardo Mazzarini
2 days ago




I didn't add a MWE because, well, there wasn't. I mean, basically the only part of the image i want to replicate is the 3d path, which is what I don't know how to do.
– Riccardo Mazzarini
2 days ago




2




2




Why pgfplots and not tikz-3dplot?
– marmot
2 days ago




Why pgfplots and not tikz-3dplot?
– marmot
2 days ago












Well I used pgfplots for all the other images in the document I'm working on, but if the end result is similar in style, then tikz-3dplot will be fine, too.
– Riccardo Mazzarini
2 days ago




Well I used pgfplots for all the other images in the document I'm working on, but if the end result is similar in style, then tikz-3dplot will be fine, too.
– Riccardo Mazzarini
2 days ago










1 Answer
1






active

oldest

votes

















up vote
4
down vote













This is just a quick attempt to produce some curve that somewhat resembles the one on your screen shot. Obviously, you do not necessarily need a parametrization, you could also draw a smooth curve through a set of known coordinates. However, as I know neither parametrization nor coordinates, this is a quick example that should give you an idea how things may look like.



documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
begin{document}
tdplotsetmaincoords{70}{130}
begin{tikzpicture}
begin{scope}[tdplot_main_coords]
pgfmathsetmacro{Radius}{3}
draw[-latex] (0,0,0) -- (1.5*Radius,0,0) node[pos=1.1]{$x$};
draw[-latex] (0,-1.5*Radius,0) -- (0,1.5*Radius,0) node[pos=1.05]{$y$};
draw[-latex] (0,0,0) -- (0,0,1.5*Radius) node[pos=1.1]{$z$};
draw[double] plot[variable=x,domain=360:0,samples=181]
({Radius*cos(x)},{Radius*sin(x)},{2.5+Radius*cos(2*x)/2});
draw (0,0,0.75*Radius) -- (0,0,1.45*Radius);
end{scope}
end{tikzpicture}
end{document}


enter image description here



Sure enough, you can draw a 3D curve it with pgfplots as well.



documentclass[tikz,border=3.14mm]{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
begin{document}
begin{tikzpicture}
begin{axis}[axis lines=middle,view={135}{45},xlabel=$x$,
ylabel=$y$,zlabel=$z$,clip=false,xtick=empty,ytick=empty,ztick=empty]
pgfmathsetmacro{Radius}{3}
addplot3[double,domain=360:0,samples=181,samples y=1]
({Radius*cos(x)},{Radius*sin(x)},{2.5+Radius*cos(2*x)/2});
end{axis}
end{tikzpicture}
end{document}


enter image description here






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460449%2fdrawing-closed-3d-path-with-pgfplots%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    4
    down vote













    This is just a quick attempt to produce some curve that somewhat resembles the one on your screen shot. Obviously, you do not necessarily need a parametrization, you could also draw a smooth curve through a set of known coordinates. However, as I know neither parametrization nor coordinates, this is a quick example that should give you an idea how things may look like.



    documentclass[tikz,border=3.14mm]{standalone}
    usepackage{tikz-3dplot}
    begin{document}
    tdplotsetmaincoords{70}{130}
    begin{tikzpicture}
    begin{scope}[tdplot_main_coords]
    pgfmathsetmacro{Radius}{3}
    draw[-latex] (0,0,0) -- (1.5*Radius,0,0) node[pos=1.1]{$x$};
    draw[-latex] (0,-1.5*Radius,0) -- (0,1.5*Radius,0) node[pos=1.05]{$y$};
    draw[-latex] (0,0,0) -- (0,0,1.5*Radius) node[pos=1.1]{$z$};
    draw[double] plot[variable=x,domain=360:0,samples=181]
    ({Radius*cos(x)},{Radius*sin(x)},{2.5+Radius*cos(2*x)/2});
    draw (0,0,0.75*Radius) -- (0,0,1.45*Radius);
    end{scope}
    end{tikzpicture}
    end{document}


    enter image description here



    Sure enough, you can draw a 3D curve it with pgfplots as well.



    documentclass[tikz,border=3.14mm]{standalone}
    usepackage{pgfplots}
    pgfplotsset{compat=1.16}
    begin{document}
    begin{tikzpicture}
    begin{axis}[axis lines=middle,view={135}{45},xlabel=$x$,
    ylabel=$y$,zlabel=$z$,clip=false,xtick=empty,ytick=empty,ztick=empty]
    pgfmathsetmacro{Radius}{3}
    addplot3[double,domain=360:0,samples=181,samples y=1]
    ({Radius*cos(x)},{Radius*sin(x)},{2.5+Radius*cos(2*x)/2});
    end{axis}
    end{tikzpicture}
    end{document}


    enter image description here






    share|improve this answer



























      up vote
      4
      down vote













      This is just a quick attempt to produce some curve that somewhat resembles the one on your screen shot. Obviously, you do not necessarily need a parametrization, you could also draw a smooth curve through a set of known coordinates. However, as I know neither parametrization nor coordinates, this is a quick example that should give you an idea how things may look like.



      documentclass[tikz,border=3.14mm]{standalone}
      usepackage{tikz-3dplot}
      begin{document}
      tdplotsetmaincoords{70}{130}
      begin{tikzpicture}
      begin{scope}[tdplot_main_coords]
      pgfmathsetmacro{Radius}{3}
      draw[-latex] (0,0,0) -- (1.5*Radius,0,0) node[pos=1.1]{$x$};
      draw[-latex] (0,-1.5*Radius,0) -- (0,1.5*Radius,0) node[pos=1.05]{$y$};
      draw[-latex] (0,0,0) -- (0,0,1.5*Radius) node[pos=1.1]{$z$};
      draw[double] plot[variable=x,domain=360:0,samples=181]
      ({Radius*cos(x)},{Radius*sin(x)},{2.5+Radius*cos(2*x)/2});
      draw (0,0,0.75*Radius) -- (0,0,1.45*Radius);
      end{scope}
      end{tikzpicture}
      end{document}


      enter image description here



      Sure enough, you can draw a 3D curve it with pgfplots as well.



      documentclass[tikz,border=3.14mm]{standalone}
      usepackage{pgfplots}
      pgfplotsset{compat=1.16}
      begin{document}
      begin{tikzpicture}
      begin{axis}[axis lines=middle,view={135}{45},xlabel=$x$,
      ylabel=$y$,zlabel=$z$,clip=false,xtick=empty,ytick=empty,ztick=empty]
      pgfmathsetmacro{Radius}{3}
      addplot3[double,domain=360:0,samples=181,samples y=1]
      ({Radius*cos(x)},{Radius*sin(x)},{2.5+Radius*cos(2*x)/2});
      end{axis}
      end{tikzpicture}
      end{document}


      enter image description here






      share|improve this answer

























        up vote
        4
        down vote










        up vote
        4
        down vote









        This is just a quick attempt to produce some curve that somewhat resembles the one on your screen shot. Obviously, you do not necessarily need a parametrization, you could also draw a smooth curve through a set of known coordinates. However, as I know neither parametrization nor coordinates, this is a quick example that should give you an idea how things may look like.



        documentclass[tikz,border=3.14mm]{standalone}
        usepackage{tikz-3dplot}
        begin{document}
        tdplotsetmaincoords{70}{130}
        begin{tikzpicture}
        begin{scope}[tdplot_main_coords]
        pgfmathsetmacro{Radius}{3}
        draw[-latex] (0,0,0) -- (1.5*Radius,0,0) node[pos=1.1]{$x$};
        draw[-latex] (0,-1.5*Radius,0) -- (0,1.5*Radius,0) node[pos=1.05]{$y$};
        draw[-latex] (0,0,0) -- (0,0,1.5*Radius) node[pos=1.1]{$z$};
        draw[double] plot[variable=x,domain=360:0,samples=181]
        ({Radius*cos(x)},{Radius*sin(x)},{2.5+Radius*cos(2*x)/2});
        draw (0,0,0.75*Radius) -- (0,0,1.45*Radius);
        end{scope}
        end{tikzpicture}
        end{document}


        enter image description here



        Sure enough, you can draw a 3D curve it with pgfplots as well.



        documentclass[tikz,border=3.14mm]{standalone}
        usepackage{pgfplots}
        pgfplotsset{compat=1.16}
        begin{document}
        begin{tikzpicture}
        begin{axis}[axis lines=middle,view={135}{45},xlabel=$x$,
        ylabel=$y$,zlabel=$z$,clip=false,xtick=empty,ytick=empty,ztick=empty]
        pgfmathsetmacro{Radius}{3}
        addplot3[double,domain=360:0,samples=181,samples y=1]
        ({Radius*cos(x)},{Radius*sin(x)},{2.5+Radius*cos(2*x)/2});
        end{axis}
        end{tikzpicture}
        end{document}


        enter image description here






        share|improve this answer














        This is just a quick attempt to produce some curve that somewhat resembles the one on your screen shot. Obviously, you do not necessarily need a parametrization, you could also draw a smooth curve through a set of known coordinates. However, as I know neither parametrization nor coordinates, this is a quick example that should give you an idea how things may look like.



        documentclass[tikz,border=3.14mm]{standalone}
        usepackage{tikz-3dplot}
        begin{document}
        tdplotsetmaincoords{70}{130}
        begin{tikzpicture}
        begin{scope}[tdplot_main_coords]
        pgfmathsetmacro{Radius}{3}
        draw[-latex] (0,0,0) -- (1.5*Radius,0,0) node[pos=1.1]{$x$};
        draw[-latex] (0,-1.5*Radius,0) -- (0,1.5*Radius,0) node[pos=1.05]{$y$};
        draw[-latex] (0,0,0) -- (0,0,1.5*Radius) node[pos=1.1]{$z$};
        draw[double] plot[variable=x,domain=360:0,samples=181]
        ({Radius*cos(x)},{Radius*sin(x)},{2.5+Radius*cos(2*x)/2});
        draw (0,0,0.75*Radius) -- (0,0,1.45*Radius);
        end{scope}
        end{tikzpicture}
        end{document}


        enter image description here



        Sure enough, you can draw a 3D curve it with pgfplots as well.



        documentclass[tikz,border=3.14mm]{standalone}
        usepackage{pgfplots}
        pgfplotsset{compat=1.16}
        begin{document}
        begin{tikzpicture}
        begin{axis}[axis lines=middle,view={135}{45},xlabel=$x$,
        ylabel=$y$,zlabel=$z$,clip=false,xtick=empty,ytick=empty,ztick=empty]
        pgfmathsetmacro{Radius}{3}
        addplot3[double,domain=360:0,samples=181,samples y=1]
        ({Radius*cos(x)},{Radius*sin(x)},{2.5+Radius*cos(2*x)/2});
        end{axis}
        end{tikzpicture}
        end{document}


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 2 days ago

























        answered 2 days ago









        marmot

        76.3k486160




        76.3k486160






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460449%2fdrawing-closed-3d-path-with-pgfplots%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Entries order in /etc/network/interfaces

            新発田市

            Grub takes very long (several minutes) to open Menu (in Multi-Boot-System)