This is just for fun and builds on this answer for the background check as well as this answer.
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usetikzlibrary{calc}
\pgfplotsset{compute projections/.code=\pgfmathsetmacro{\CameraX}{sin(\pgfkeysvalueof{/pgfplots/view/az})*cos(\pgfkeysvalueof{/pgfplots/view/el})}
\pgfmathsetmacro{\CameraY}{-cos(\pgfkeysvalueof{/pgfplots/view/az})*cos(\pgfkeysvalueof{/pgfplots/view/el})}
\pgfmathsetmacro{\CameraZ}{sin(\pgfkeysvalueof{/pgfplots/view/el})},
only foreground/.style={compute projections,
restrict expr to domain={rawx*\CameraX + rawy*\CameraY + rawz*\CameraZ}{-0.05:100},
},only background/.style={compute projections,
restrict expr to domain={rawx*\CameraX + rawy*\CameraY + rawz*\CameraZ}{-100:0.05}
}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
domain=-1:1,
samples=10,
xmin=-1.5,xmax=1.5,
ymin=-1.5,ymax=1.5,
zmin=-1.5,zmax=1.5,
]
\addplot3[,quiver,-stealth,only background,%opacity=0.1,
domain=0:360,domain y=-90:90,point meta=1,
quiver={
u={x/sqrt((x)^2+(y)^2+(z)^2)},
v={y/sqrt((x)^2+(y)^2+(z)^2)},
w={z/sqrt((x)^2+(y)^2+(z)^2)},
colored,scale arrows=0.5}]
({cos(y)*cos(x)},{-cos(y)*sin(x)},{sin(y)});
%}
\draw[ball color=gray] let \p1=($(0,0,1.75)-(0,0,0)$) in
(0,0,0) circle[radius=\y1];
\addplot3[quiver,-stealth,only foreground,%opacity=0.1,
domain=0:360,domain y=-90:90,point meta=1,
quiver={
u={x/sqrt((x)^2+(y)^2+(z)^2)},
v={y/sqrt((x)^2+(y)^2+(z)^2)},
w={z/sqrt((x)^2+(y)^2+(z)^2)},
colored,scale arrows=0.5}]
({cos(y)*cos(x)},{-cos(y)*sin(x)},{sin(y)});
\end{axis}
\end{tikzpicture}
\end{document}
tikz-pgf
, you may want to have a look atquiver plots
that come withpgfplots
, which is based on TikZ.