I'm working on this plot with pgfplots:
The image is from our sister-site Mathematica.SE and there's also a nice explanation how to do it with Mathematica.
I follow these steps:
- Parametrize the 2d cut
- Embed it in 3d
- Rotate both in a circle and around itself
I originally posted the question on the TeXwelt LaTeX forum in German, my first steps which I wrote in "Drehtransformation mit pgfplots" are:
The 2d cut:
\documentclass[border=10pt]{standalone} \usepackage{pgfplots} \usepgfplotslibrary{polar} \begin{document} \begin{tikzpicture} \begin{polaraxis} \addplot[mark=none, domain=0:360, samples=100] {sin(3*x) + 1.25}; \end{polaraxis} \end{tikzpicture} \end{document}
Embedding in 3d for better visualizing with some temporary filling:
\documentclass[border=10pt]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} \addplot3 [domain=0:360, samples=60, fill=blue!30, opacity=0.8] ( {cos(x)*(sin(3*x) + 1.25)}, {sin(x)*(sin(3*x) + 1.25)}, 0 ); \end{axis} \end{tikzpicture} \end{document}
No problem also to get a surface with simple 3d expansion:
\documentclass[border=10pt]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} \addplot3 [ surf, domain = 0:360, y domain = 0:360, samples = 50, samples y = 20, ] ( {cos(x)*(sin(3*x) + 1.25)}, {y}, {sin(x)*(sin(3*x) + 1.25)} ); \end{axis} \end{tikzpicture} \end{document}
That's my question, because I still need to bend and twist it:
How can I rotate that 2d plot around a circle, while rotating it at the same time around its origin, to get a surface plot like in the image at the top?