# Parametric Plot 3D, Helix and Astroidal Sphere

Can somebody help me with creating two plots -- a Helix and an Astroidal Sphere -- in LaTeX? The attached pictures are screenshots from Mathematica and show the desired results.

• Hi Reina Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Aradnix Sep 4 '14 at 20:31
• I'm not sure about what you want to do in LaTeX. Do yo need to insert those two pictures inside a document, or are you trying to generate them inside LaTeX instead of Mathematica? – Aradnix Sep 4 '14 at 20:33
• I have so many packages in my document, so it's not a problem. I want to draw a picture in Latex, and all I have is this parametric equations: x(u,v)=[ 1.2+0.5*Cos(v)]*Cos(u) , y(u,v)=[1.2+0.5*Cos(v)]Sin(u) , z(u,v)=0.5*Sin(v)+ u/pi where is: 0<u<4pi and 0<v<2pi – Bosanka Sep 4 '14 at 20:41
• If you speak Spanish and feel more comfortable asking in Spanish, you can subscribe in the [mail list of the CervanTeX]() and ask there also. There is not much activity as here, but it can help yourself for future reference. Regarding your question, I don't know how convenient is redo your figures into LaTeX, but if you want to try, Tikz is the package you should use. One of its many libraries is suitable to draw figures like these. – Aradnix Sep 4 '14 at 20:47
• Please check this answer related with yours, I hope you find it useful. Since I am still a newbie in Tikz I can't help you so much. – Aradnix Sep 4 '14 at 20:49

## 2 Answers

Run with xelatex (takes some time) or latex->dvips->ps2pdf:

\documentclass{article}
\usepackage{pst-solides3d}
\begin{document}

\psset{unit=0.75}
\begin{pspicture}(-3,-4)(3,6)
\psset{viewpoint=20 70 10 rtp2xyz,Decran=20,lightsrc=viewpoint}
% Parametric Surfaces
\defFunction[algebraic]{helix}(u,v)
{(1.2+0.5*cos(v))*cos(u)}
{(1.2+0.5*cos(v))*sin(u)}
{0.5*sin(v)+u/Pi}
\psSolid[object=surfaceparametree,linewidth=0.5\pslinewidth,
base=-7 6.5 0 TwoPi,hue=0 1,function=helix,ngrid=30 0.4]%
\gridIIID[Zmin=-3,Zmax=3](-2,2)(-2,2)
\end{pspicture}

\psset{unit=3cm}
\begin{pspicture}(-2,-2)(2,2)
\psset{viewpoint=20 70 10 rtp2xyz,Decran=20,lightsrc=viewpoint}
% Parametric Surfaces
\defFunction[algebraic]{helix}(u,v)
{(cos(v)*cos(u))^3}
{(cos(v)*sin(u))^3}
{sin(v)^3}
\psSolid[object=surfaceparametree,linewidth=0.5\pslinewidth,
base=0 Pi 0 TwoPi,fillcolor=red,function=helix,ngrid=20 40]%
\gridIIID[Zmin=-1,Zmax=1,showAxes=false](-1,1)(-1,1)
\end{pspicture}

\end{document}


• OMG :D thank you, thank you, thank you soooo much Herbert :D – Bosanka Sep 4 '14 at 21:19
• The labels are in text mode, e.g., the minus sign - are hyphens. Is this a bug? – Manuel Sep 4 '14 at 21:46
• seems so. I'll upload a new version to CTAN – user2478 Sep 5 '14 at 7:51

Here is my version:

\documentclass[border=10pt]{standalone}
\usepackage[pdftex]{graphicx}
\usepackage{pgfplots}
\usepgfplotslibrary{colormaps}

\begin{document}
\begin{tikzpicture}[yscale=2, xscale=1]
\begin{axis}[axis line style={draw=none},
view={170}{-20},
grid=major,
xmin=0,xmax=2,
ymin=0,ymax=2,
zmin=0,zmax=4,
enlargelimits=upper,
xtick=\empty,
ytick=\empty,
ztick=\empty,
%colormap/bone,
trig format plots=rad,
clip=false
]
\addplot3 [ surf, domain=0:12.566, domain y=0:6.28,
samples=70, samples y=70,
variable=\u, variable y=\v,
point meta=u*v, opacity=0.4 ]
({(1.2+0.5*cos(v))*cos(u)},
{(1.2+0.5*cos(v))*sin(u)},
{0.5*sin(v)+u/(3.0)});

\end{axis}
\end{tikzpicture}
\end{document}


And here the picture