Plotting in three dimensions
Visualizing functions with two arguments can be challenging. We can create three-dimensional plots in documents; however, achieving this in print or as a PDF demands a projection, a viewpoint, or an angle, along with considerations about depth, causing certain portions to be obscured while others remain visible.
Previously, we plotted the function f(x) = sin(x). Now, by adding an additional dimension, we’ll visualize the function 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 the article class instead:
\documentclass[border=10pt]{standalone}
- Load the pgfplots package:
\usepackage{pgfplots}
- Begin the document and open a tikzpicture environment:
\begin{document} \begin{tikzpicture}
- Begin an axis environment with options...