Drawing closed 3d path with pgfplots
up vote
1
down vote
favorite
I'd like to reproduce the following 3d image using pgfplots 
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
add a comment |
up vote
1
down vote
favorite
I'd like to reproduce the following 3d image using pgfplots 
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
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
Whypgfplotsand nottikz-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
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'd like to reproduce the following 3d image using pgfplots 
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
I'd like to reproduce the following 3d image using pgfplots 
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
tikz-pgf 3d
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
Whypgfplotsand nottikz-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
add a comment |
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
Whypgfplotsand nottikz-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
add a comment |
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}

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}

add a comment |
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}

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}

add a comment |
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}

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}

add a comment |
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}

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}

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}

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}

edited 2 days ago
answered 2 days ago
marmot
76.3k486160
76.3k486160
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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
pgfplotsand nottikz-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