Plotting in three dimensions
Functions with two arguments can be visualized in three-dimensional plots. Getting this on paper or into a PDF is a bit more challenging. We need a projection, a view point or angle, and a depth, which means that some parts will be hidden and others in the front.
At the end of the previous recipe, we plotted the function f(x) = sin(x). Now, when we add a dimension, we will plot f(x,y) = sin(x)*sin(y).
How to do it...
Like in the previous recipe, we will use the pgfplots
package. Follow these steps:
- Start with a document class. Like in the previous recipe, we use the
standalone
class. But it's fine if you choose thearticle
class instead.\documentclass[border=10pt]{standalone}
- Load the
pgfplots
package:\usepackage{pgfplots}
- Start the document, and open a
tikzpicture
environment:\begin{document} \begin{tikzpicture}
- Begin an
axis
environment with options:\begin{axis} [ title = {$f(x,y) = \sin(x)\sin(y)$}, xtick = {0,90,...,360}, ytick = {90...