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, there’s a depth which means parts should be hidden and others in the front.

We will use the pgfplots package to plot f(x,y) = sin(x)*sin(y).

The code, and more, is explained in the LaTeX Cookbook, Chapter 10, Advanced Mathematics, Plotting in three dimensions.

3d plot

% Plotting in three dimensions
% Author: Stefan Kottwitz
\begin{axis} [
    title = {$f(x,y) = \sin(x)\sin(y)$},
    xtick = {0,90,...,360},
    ytick = {90,180,...,360},
    xlabel = $x$, ylabel = $y$,
    ticklabel style = {font = \scriptsize},
\addplot3 [surf, domain=0:360, samples=60] 
	{ sin(x)*sin(y) };
Click to download: 3d-plot.tex3d-plot.pdf
Open in Overleaf: 3d-plot.tex