# Reproducing a 3dplot example from texample.net using pgfplots: drawing angles with pgfplots in 3d [closed]

I am trying to reproduce the 3dplots example from www.texample.net using pgfplots:

So far, I did not come far at all, actually. One problem is that pgfplots does not allow to work in spherical coordinates, so I have to express everything in cartesian coords. The other problem is that pgfplots does not provide an easy way to draw arcs like 3dplots does with \tdplotdrawarc so that showing the angle between the vector and the z-axis (\theta) or the angle between the vector and the x-y-plane (\phi) proves difficult. I could imagine doing the latter by drawing a circle in the x-y-plane, but I don't know how to draw a circle in the plane described by the vector and the z-axis.

Any ideas how to tackle this?

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{pgfplots}

\begin{document}

\pgfmathsetmacro{\rvec}{.8}
\pgfmathsetmacro{\thetavec}{30}
\pgfmathsetmacro{\phivec}{60}

\begin{tikzpicture}
\begin{axis}[
view={115}{30},
axis lines=center,
%        xlabel=$e^1$,% Horribly misplaced label
%        ylabel=$e^2$,% Makes the entire plot break when used with xlabel
z post scale=1.5
]

{x*sin(\thetavec)*sin(\phivec)},%
{x*cos(\thetavec)});
\end{axis}
\end{tikzpicture}

\end{document}

-

## closed as too localized by Stefan Kottwitz♦May 5 '12 at 22:42

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

Could you explain a little bit more about your motivation to use pgfplots for this? It's not really what pgfplots was meant to do, which will make this quite tedious. If you want to annotate a 3D plot created with pgfplots, maybe it's best to ask a question specifically about that, or if there's something missing / not working with 3dplot, people here might be able to help with that. –  Jake Jan 31 '12 at 21:05
I suggest you to use link. It is a little program that permits you to create a 3D scene and converts it to TikZ. –  Azoun Jan 31 '12 at 21:09
@ Jake: I thought 3dplot has only a subset of pgfplot's capabilities, but I realize now that they are very different packages and pgfplots was not meant to do what 3dplot does. I thought it would be easy to just reproduce the above example. I think I will stick to 3dplot, however. @Azoun: Thanks, I am going to look into that package. Looks very interesting. –  mSSM Feb 1 '12 at 16:57