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} ...
Get LaTeX Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.