# Using equations to draw in LaTeX

Is it possible to use equations to draw geometric objects like spheres or planes in LaTeX, using TikZ maybe?

It may be parametrized.

Thank you!

• pgfplots.sourceforge.net/gallery.html \begin{tikzpicture} \begin{axis}[ xlabel=$x$, ylabel={$f(x) = x^2 - x +4$} ] % use TeX as calculator: \addplot {x^2 - x +4}; \end{axis} \end{tikzpicture} Dec 15 '15 at 12:30
• Or read the section of the TikZ manual on plotting functions? (pgfplots may be more powerful - not sure.)
– cfr
Dec 15 '15 at 22:20
• Consider asymptote, an external program with C-like syntax in which you write equations to define lines/surfaces Jan 14 '16 at 0:04

## 1 Answer

You can do it simply by using pgfplots package. Here are some examples added in one plot. You may use your own functions or the options you prefer to be included in your plot. Just read the package's instructions document. This package is great.

%pdfLateX

\documentclass{standalone}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot3[surf]{x};
\addplot3[surf]{x^2+y^2};
\end{axis}
\end{tikzpicture}

\end{document}