# Sphere with spherical coordinates

> A point on a sphere located by its radius and the angles θ and φ. A tikz-3dplot example with its complete LaTeX source, ready to copy or open in TeXeR.

A tikz-3dplot example in the TeXeR TikZ library: https://texer.org/library/tikz-3dplot/spherical-sphere

Package: [tikz-3dplot](https://texer.org/library/tikz-3dplot.md), on CTAN at https://ctan.org/pkg/tikz-3dplot.

Tags: sphere, spherical coordinates, 3D, angles

## Source

```latex
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta, calc}

\tdplotsetmaincoords{70}{110}
\begin{tikzpicture}[tdplot_main_coords, scale=2.4, >={Stealth}]
  \coordinate (O) at (0,0,0);
  \tdplotsetcoord{P}{1}{50}{60}
  \draw[tdplot_screen_coords, thick, ball color=blue!8, opacity=0.6] (0,0) circle (1);
  \draw[gray] (0,0,0) circle (1);
  \draw[->] (0,0,0) -- (1.4,0,0) node[anchor=north east] {$x$};
  \draw[->] (0,0,0) -- (0,1.4,0) node[anchor=north west] {$y$};
  \draw[->] (0,0,0) -- (0,0,1.4) node[anchor=south] {$z$};
  \draw[->, very thick, blue!70!black] (O) -- (P) node[above right] {$P$};
  \draw[dashed] (O) -- (Pxy) -- (P);
  \tdplotdrawarc[->, orange!85!black]{(O)}{0.35}{0}{60}{anchor=north}{$\phi$}
  \tdplotsetthetaplanecoords{60}
  \tdplotdrawarc[tdplot_rotated_coords, ->, orange!85!black]{(O)}{0.45}{0}{50}{anchor=south west}{$\theta$}
  \fill (P) circle (0.6pt);
\end{tikzpicture}
```

## As a complete document

The same example in a document that compiles on its own with pdfLaTeX:

```latex
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows.meta, calc}

\begin{document}

\tdplotsetmaincoords{70}{110}
\begin{tikzpicture}[tdplot_main_coords, scale=2.4, >={Stealth}]
  \coordinate (O) at (0,0,0);
  \tdplotsetcoord{P}{1}{50}{60}
  \draw[tdplot_screen_coords, thick, ball color=blue!8, opacity=0.6] (0,0) circle (1);
  \draw[gray] (0,0,0) circle (1);
  \draw[->] (0,0,0) -- (1.4,0,0) node[anchor=north east] {$x$};
  \draw[->] (0,0,0) -- (0,1.4,0) node[anchor=north west] {$y$};
  \draw[->] (0,0,0) -- (0,0,1.4) node[anchor=south] {$z$};
  \draw[->, very thick, blue!70!black] (O) -- (P) node[above right] {$P$};
  \draw[dashed] (O) -- (Pxy) -- (P);
  \tdplotdrawarc[->, orange!85!black]{(O)}{0.35}{0}{60}{anchor=north}{$\phi$}
  \tdplotsetthetaplanecoords{60}
  \tdplotdrawarc[tdplot_rotated_coords, ->, orange!85!black]{(O)}{0.45}{0}{50}{anchor=south west}{$\theta$}
  \fill (P) circle (0.6pt);
\end{tikzpicture}
\end{document}
```
