Planes in Spherical Coordinates

spherical_3

Edit and compile if you like:

\documentclass[border=3pt]{standalone}

%Drawing
\usepackage{tikz}

%3D
\usepackage{tikz-3dplot}

%Tikz Library
\usetikzlibrary{angles, quotes, intersections}

%Styles
\tikzset{axis/.style={thick,-latex}}
\tikzset{vec/.style={thick,blue}}
\tikzset{univec/.style={thick,red,-latex}}

%Notation
\usepackage{physics}
\usepackage{bm}

\begin{document}

	%Layers
	\pgfdeclarelayer{background}
	\pgfdeclarelayer{foreground}

	\pgfsetlayers{background, main, foreground}
	
	\tdplotsetmaincoords{70}{110}
	%
	\pgfmathsetmacro{\thetavec}{48.17}
	\pgfmathsetmacro{\phivec}{63.5}
	%
	
	\begin{tikzpicture}[tdplot_main_coords]
    	%Areas
		\begin{pgfonlayer}{main}
			\path[opacity=0.5, fill=black!20] (0,0,0) -- ++(11.5,0,0) -- ++(0,9,0) -- +(-11.5,0,0) -- cycle;
			\path[opacity=0.5, fill=blue!20] (0,0,0) -- (2,4,0) -- (10.1,0,0) -- cycle;
			\path[opacity=0.5, fill=red!20] (0,0,0) -- (2,4,4) -- (3.6,7.2,0) -- cycle;		
		\end{pgfonlayer}

		%Axis
		\begin{pgfonlayer}{background}
			\draw[axis] (0,0,0) -- (0,9.5,0) node [pos=1.05] {$y$};
			\draw[axis] (0,0,0) -- (0,0,5.5)  node [pos=1.05] {$z$};  
		\end{pgfonlayer}
		\begin{pgfonlayer}{main} 
			\draw[axis] (0,0,0) -- (12,0,0) node [pos=1.05] {$x$};	
		\end{pgfonlayer}

		%Secondary
		\begin{pgfonlayer}{background}
			\tdplotsetcoord{R}{6.5}{90+\thetavec}{\phivec}
    		\draw[axis] (2,4,4) -- ($(R) + (2,4,4)$) node [pos=1.025] {$\theta$};	
		\end{pgfonlayer}

		\begin{pgfonlayer}{foreground}
			\tdplotsetcoord{R'}{5.37}{90+\thetavec}{\phivec}
    		\draw[thick] (2,4,4) -- ($(R') + (2,4,4)$);	
	    	\tdplotsetcoord{S}{5.5}{90}{\phivec}
    		\draw[axis] (2,4,0) -- ($(S)+(2,4,0)$) node [pos=1.1] {$\varpi$};
		\end{pgfonlayer}
    			
		%Unit Vectors
		\begin{pgfonlayer}{foreground}
			\tdplotsetcoord{p}{1}{90}{\phivec}
	    	\draw[univec] (2,4,0) -- ($(p)+(2,4,0)$) node [pos=0.3,below] {$\vu*{\varpi}$};
			\tdplotsetcoord{P'}{7}{\thetavec}{\phivec}
	    	\draw[univec] (0,0,0) -- (P') node [pos=1.05] {$\vu{r}$};
	    	\tdplotsetcoord{P'''}{1}{90+\thetavec}{\phivec}
	    	\draw[univec] (2,4,4) -- ($(P''') + (2,4,4)$) node [above right] {$\vu*{\theta}$};
	    	\draw[univec] (0,0,0) -- (1.3,0,0) node [pos=0.3, above left] {$\vu{x}$};
	    	\draw[univec] (0,0,0) -- (0,0,1) node [left] {$\vu{z}$};
		\end{pgfonlayer}
		\begin{pgfonlayer}{background}
			\tdplotsetcoord{P''}{1}{90}{90+\phivec}
	    	\draw[univec] (2,4,0) -- ($(P'') + (2,4,0)$) node [pos=1.3] {$\vu*{\phi}$};
	   		\draw[univec] (0,0,0) -- (0,1,0) node [above] {$\vu{y}$};
		\end{pgfonlayer}
		%%
		\tdplotsetcoord{K}{10}{90}{90+\phivec}
	    \draw[thick] (2,4,0) -- ($(2,4,0) - (K)$);


		
		%Vectors
		\begin{pgfonlayer}{foreground}
			\tdplotsetcoord{P}{6}{\thetavec}{\phivec}
			\draw[vec] (0,0,0) -- (P) node [midway, above] {$r$};
			\draw[thick] (0,0,0) -- (2,4,0) node [pos=0.6, above] {$\varpi$};
		\end{pgfonlayer}
		
		%Help Lines
		\begin{pgfonlayer}{background}
			\draw[dashed] (0,4,0) -- (2,4,0) node [pos=-0.3] {$y$};
			\draw[dashed] (0,0,4) -- (2,4,4) node [pos=-0.1] {$z$};
			\draw[dashed, tdplot_main_coords] (4.47,0,0) arc (0:90:4.47);
		\end{pgfonlayer}
		\begin{pgfonlayer}{main}
			\draw[dashed] (2,4,4) -- (2,4,0);
			\draw[dashed] (2,0,0) -- (2,4,0) node [pos=-0.1] {$x$};
			\draw[dashed, tdplot_main_coords] (4.47,0,0) arc (0:\phivec:4.47);
		\end{pgfonlayer}

		
		%Point
		\begin{pgfonlayer}{foreground}
			\node[fill=black, circle, inner sep=0.8pt] at (2,4,4) {};
		\end{pgfonlayer}
		
		%Angles
		\begin{pgfonlayer}{main}
			\tdplotdrawarc{(0,0,0)}{0.7}{0}{\phivec}{below}{$\phi$}
		 	%
		    \tdplotsetthetaplanecoords{\phivec}
		    \tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{0.5}{0}{\thetavec}{}{}
		    \node at (0,0.25,0.67) {$\theta$};
		\end{pgfonlayer}
		\begin{pgfonlayer}{background}
			\tdplotsetthetaplanecoords{\phivec}
			\tdplotdrawarc[tdplot_rotated_coords]{(0,8.05,0)}{0.4}{140}{90}{}{}
		    \node at (4.5,8,0) {$\theta$};
		\end{pgfonlayer}

		
	\end{tikzpicture}
	
\end{document}

Click to download: spherical_3.tex
Open in Overleaf: spherical_3.tex
This file is available on GitHub.
See more on the author page of Alexandros Tsagkaropolulos.

Leave a Reply

Your email address will not be published.