CoCalc -- Collaborative Calculation in the Cloud
SharedPublic / pstricks-demo.texOpen in CoCalc

\documentclass{article}
\usepackage{pst-3dplot}
\usepackage{pstricks}
\usepackage{hyperref}

\begin{document}

Note: set Engine in the CoCalc Build panel to XeLaTeX when using pstricks.

\begin{center}
\psset{unit=0.7,Alpha=75}
\begin{pspicture}(-2.25,-3.5)(7.25,6.5)
  \pstThreeDCoor[linecolor=red,xMax=7,yMax=7,zMax=7]
  \pstThreeDLine[SphericalCoor,linecolor=blue]{->}(0,0,0)(10,45,60)
  \pstThreeDDot[SphericalCoor,drawCoor](10,45,60)
  \pstThreeDPut[SphericalCoor](10.5,45,65){$(x,y,z)$}
  \pstThreeDNode[SphericalCoor](5,45,60){A}\pstThreeDNode(0,0,4){B}
  \ncarc[arcangle=20]{->}{B}{A}
  \pstThreeDPut[SphericalCoor](4,45,70){$\phi$}
  \pstThreeDNode[SphericalCoor](2,45,0){B}\pstThreeDNode(2,0,0){A}
  \ncarc[angleA=180]{<-}{B}{A}
  \pstThreeDLine[SphericalCoor,linestyle=dashed](0,0,0)(5,45,0)
  \pstThreeDPut[SphericalCoor](2.5,25,0){$\theta$}
  \pstThreeDPut[SphericalCoor](6,45,50){$r$}
\end{pspicture}

Scheme of Spherical Coordinates in $\,R^3\,$ using \textit{pstricks}.

Adapted from \url{http://tug.org/PSTricks/main.cgi?file=pst-plot/3D/examples}
\end{center}

\bigskip
\small
\begin{verbatim}
\psset{unit=0.7,Alpha=75}
\begin{pspicture}(-2.25,-3.5)(7.25,6.5)
  \pstThreeDCoor[linecolor=red,xMax=7,yMax=7,zMax=7]
  \pstThreeDLine[SphericalCoor,linecolor=blue]{->}(0,0,0)(10,45,60)
  \pstThreeDDot[SphericalCoor,drawCoor](10,45,60)
  \pstThreeDPut[SphericalCoor](10.5,45,65){$(x,y,z)$}
  \pstThreeDNode[SphericalCoor](5,45,60){A}\pstThreeDNode(0,0,4){B}
  \ncarc[arcangle=20]{->}{B}{A}
  \pstThreeDPut[SphericalCoor](4,45,70){$\phi$}
  \pstThreeDNode[SphericalCoor](2,45,0){B}\pstThreeDNode(2,0,0){A}
  \ncarc[angleA=180]{<-}{B}{A}
  \pstThreeDLine[SphericalCoor,linestyle=dashed](0,0,0)(5,45,0)
  \pstThreeDPut[SphericalCoor](2.5,25,0){$\theta$}
  \pstThreeDPut[SphericalCoor](6,45,50){$r$}
\end{pspicture}
\end{verbatim}

\end{document}