Get a free year on Tuts+ this month when you purchase a Siteground hosting plan from $3.95/mo
Grapher is one of those tools on OS X that is sadly abandoned. I'd even go so far as to say that a majority of Mac users either wouldn't know it existed or (without using either Spotlight or Alfred) wouldn't know where to find it. I find this a real shame, as Grapher is actually an extremely powerful little utility that can work wonders for you -- if you know how to use it properly.
Anyone who has tried to draw a graph in Excel will know what I mean -- it's a real hassle. This tutorial will teach you how to use Grapher to plot and draw some amazing graphs and show you the fundamentals of using this powerful little tool. You'll soon discover that it isn't just a mundane little tool that's buried away within your utilites folder but rather one of the most powerful and functional bundled apps on OS X!
Tip: This tutorial assumes you are comfortable with mathematical notation and (relatively) complicated equations!
1. Getting Started
Start up Grapher by going to your Utilities folder and clicking on the icon. You'll then be presented with the following window, which will ask you to choose between a 2D and 3D graph. At this stage, we'll create a simple, 2D default graph:
Grapher itself has three separate areas, which you can see highlighted in the screenshot below. The red area is where all your graphs are displayed; the blue area is the equation editor, where you enter all your equations and the green area keeps track of the equations you have already entered.
2. Entering Your First Equation
Entering equations in Grapher is really nice and easy. All you have to remember is use * for multiplication, / for division and the ^ for any exponentials. There's even a handy equation palette which provides quick and easy access to some of the most common mathematical operators and you can also enter certain mathematical symbols (and Greek letters) by just typing in its name, so sqrt will yield √, alpha will yield α, theta θ and so on.
As they are handled slightly differently in Grapher, let's take a look at explicit and implicit equations, and how to draw these in Grapher.
3. Working With Explicit Equations
Explicit equations are usually in the form: . So, to plot the equation: , then simply type in: x ^ 2 and hit Enter. Grapher will format the equation correctly and plot it for you on the graph screen. Note that the equation also appears in the left-hand side of the screen (you can click on the check boxes to hide or show equations you have already plotted).
Of course, the equation above is relatively simple and Grapher can plot much more complicated equations than that! Let's try plotting the equation:
This looks relatively nasty but is fairly easy inside Grapher. Simply enter: ln x ^ 3 [right arrow] / x [right arrow] * sqrt ( x ^ 2 [right arrow] 1 / x. The right arrows are required so that Grapher knows where one exponent finishes and another one starts -- otherwise the equation will be squashed up completely and not displayed properly.
Manipulating graphs is very easy. You can zoom in and out of each one using the toolbar buttons and you can also click on any point on your graph to determine its exact co-ordinates (this is useful if, for example, you want to work out the minima and maxima of a function). The Inspector button in the top-right lets you change the style of your graph.
Now that we've had a look at explicit equations, let's take a look at the flipside and consider implicit equations.
4. Working With Implicit Equations
When you enter a new equation, Grapher sets it up as an explicit equation by default by providing the y= bit for you to kick off. So now, go ahead and delete this. Let's start off with the simple implicit equation: .
You should already know how to plot this, but if you don't, then here's a reminder: x ^ 2 + y ^ 2 = 1. You'll find that Grapher draws you a nice, simple circle around the origin.
Grapher supports both cartesian coordinates (x and y) and polar coordinates (r and θ).
5. Working With Point Sets
Beside equations, you can also use Grapher to plot custom data sets, though it can be a bit fiddly and if you're wanting to create a graph for a few bits of data, then it's best to use a spreadsheet program such as Excel or Numbers. Create a new graph by clicking on File > New... or a new equation (Equation > New Equation) then click on Equation > New Point Set.
To edit the individual points, click on Edit Points. You can add and delete new ones as well as import from CSV files (click on the Import button then locate the file you wish to import).
When you've finished, click on OK and your new points will be added to your graph. Unfortunately, as of yet you can't drag points around with the mouse -- you'll have to go back into the Edit Points dialogue box and change them there.
6. Customising Your Graphs
Grapher gives you plenty of options to customise your graphs so let's have a look at them individually.
Step 1: Using Colours
My personal favourite is being able to colour each equation plot separately. This is especially useful if you want to display several equations on one graph. To do this, enter your first equation then click on the Inspector tool on the left-hand side of the screen and choose a colour from the palette.
Then, enter your second equation (whatever this might be) by clicking on Equation > New Equation and again click on the Inspector and select a colour for this new equation:
Put the two together (make sure both check boxes are selected on the left-hand side) and you are presented with two colour-coded equations on the same graph. You can selectively hide and show each one by clicking on the check boxes and delete individual equations as necessary.
Step 2: Working With Axes
From time to time, you'll want to modify your graph's axes to fit with the data you're working with. Grapher automatically resizes axes based on the data but you can double-click on either the x or y axes, which will bring up a window where you can modify the axes accordingly.
You can easily switch the graph template without having to create a new document by going to Format > Graph Template and selecting a new style.
Step 3: Inserting Shapes and Text
If you wish to annotate your graphs, then Grapher will let you do this. Click on Object in the top menu bar then select the shape you would like to insert. You can drag it around using the mouse and the Inspector will let you customise it, such as the colour and fill.
Annotations can be really useful if you wish to highlight certain areas or points on the graph but the options available are a little simplistic, so if you want to do something a bit more advanced then it's best to export the graph as an image then edit it in an external image editor (Pixelmator or Photoshop, for example).
Well done for making it through this tutorial! I hope that it has given you a solid understanding of Grapher and what it can do for you -- it really is a powerful utility that when used properly can give you some outstanding results with little effort.
You don't need to be a mathematical genius to use Grapher but it does help if you understand basic calculus so you can get to grips with the functions. And of course, if you have any suggestions or tips then please feel free to share them in the comments section below for the benefit of our fellow users!