My Two-Day Crash Course in PGFPlots and TikZ

I will be teaching multivariable calculus in the fall. During the semester, I’ll have to make numerous figures in two-and three-dimensional space for exams and handouts. One of the things I wanted to do this summer was to learn how to use TikZ to create graphs and other graphics in my LaTeX documents.

After a little exploration, I discovered that PGFPlots was the LaTeX package I was looking for. It makes drawing graphs in TikZ easy, and the graphs are highly customizable. So, for the last two days, I dove in and started playing with it. I’ve included some of my creations below.

If you would like to see the LaTeX code for these figures, you can open this Overleaf link. Feel free to copy and modify them. Since I’m a beginner, I can’t promise that I’ve created them the best and most efficient way.

There is one thing I should mention. In order to generate the contour plots (the last two figures at the bottom of this post), I had to install gnuplot on my computer. (This was a little bit involved.) If you are using Overleaf, you don’t have to do this, but if you are using a desktop LaTeX program, you will probably have to.

As a last comment: It may take a little while for the document to compile in Overleaf. Each figure has to be regenerated each time the document compiles. There is a way to keep this from happening—essentially it regenerates the figure only when there is a change to the code for that figure. You can read more about that approach on this page.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s