Vector field on a ball
It is usually easier to draw 3D figures with Asymptote. Here's a solution:
\documentclass{standalone}
\usepackage{asymptote}
\begin{document}
\begin{asy}[width=10cm,height=10cm]
import three;
// 1st field
triple X(triple p) {
return (-p.y, p.x, 0 );
}
// 2nd field
triple Y(triple p) {
return (p.x*p.z, p.y*p.z, -(p.x*p.x + p.y*p.y));
}
// unit sphere S2
material mat = material(diffusepen=gray(0.4),emissivepen=gray(0.6));
draw(unitsphere,mat);
// draw fields
int ni = 20;
int nj = 20;
real sc = 0.1;
for(int i=0; i<ni; ++i) {
for(int j=0; j<nj; ++j) {
real ph = (2*pi/ni)*i;
real th = (pi/nj)*j;
triple a = (cos(ph)*sin(th), sin(ph)*sin(th), cos(th));
triple xx = a + sc*X(a);
triple yy = a + sc*Y(a);
draw(a--xx,green,Arrow3);
draw(a--yy,red,Arrow3);
}
}
\end{asy}
\end{document}
You first need to translate the file with latex
, then run asy
on the generated .asy
file and then again latex
once or twice. The result looks like this:
You can try this simple solution:
\documentclass[border=2mm,tikz]{standalone}
\usetikzlibrary{decorations.markings,arrows}
\begin{document}
\begin{tikzpicture}[decoration={markings,mark=at position .5 with {\arrow{latex'}}}]
\filldraw[ball color=white] (0,0) circle (1.2cm);
\foreach \rx in {-1,-.6,...,1}{
\draw[densely dashed,very thin,postaction={decorate}] (0,1.2) arc (90:-90:{\rx} and 1.2);
\draw[densely dashed,very thin,postaction={decorate}] (-1.2,0) arc (180:0:{1.2} and {\rx});}
\end{tikzpicture}
\end{document}
which gives the following picture: