Many technical graphs show multiple variables on a single graph. One example of this is to use different types of plots on the same graph. For instance, you can have a bar chart and a line/scatter plot on the same graph. Other users use multiple axes to show widely different variables side by side using the same type of plot. Having the ability to show different types of graphs or different scales on the same graph is critical in visual data analysis. These graphs are very easy to create in Grapher, with just a little bit of manipulation to the graph.
Creating stacked graphs
The first graph is by far the easiest to create. Create the base graph as you would normally create it, using the commands under the Graph menu. For instance, if your base graph is a line/scatter plot, you would choose Graphs | Basic | Line/Scatter Plot command. After selecting the worksheet, the default graph will be displayed. Change any properties of the curve to distinguish it from the other curves that you will add. For instance, you can change line style, color, add fill, add symbols, add labels, etc. The result is a standard line/scatter plot, similar to the one below.
The original graph shows a single
line/scatter plot on a single set of axes.
The key in all multiple variable graphs is altering the first graph to give room for the additional graphs. In this stacked graph, we will be adding a second line/scatter plot on a different Y axis. Because the second Y axis will be placed above the original Y axis, we will want to change the length of both Y axes. Otherwise, the second axis is likely to exceed the size of our paper. To change the first Y axis length, select Y Axis 1 in the Object Manager. In the Property Manager, click the Axis tab to view the Axis Properties section. Change the Length to 3.00 inches.
Set the axis Length property to 3 inches.
Adding a second stacked Y Axis
With any part of the graph selected, choose Graphs | Add to Graph | Axis. In the Axis Type dialog, select Y Axis and click OK. This axis will be placed above the existing Y Axis 1. So, change the drop down list to show Y Axis 1. Then, change the Position to be At the top of... and click OK. With the Y Axis 2 selected, change the Length in the Property Manager to show 3.00 inches.
Adding a second curve to the upper axis
Now that you have a second axis, you can add your second curve. With any part of the graph selected, click Graphs | Add to Graph | Plot. In the Select Plot Type dialog, select Line/Scatter Plot and click OK. In the Choose Axes dialog, select X Axis 1 and Y axis 2 and click OK. Select the worksheet and click Open. Make any changes to the new curve to distinguish it from the other curves that you have created.
A stacked graph is shown with two
line/scatter plots on different Y axes.
Any portion of either graph can be changed. The X axis is shared between the stacked graphs, so comparisons between graphs is possible.
Creating overlaid graphs
Another common way of showing multiple variable graphs is to show the graphs "overlaid" with Y axes that are on either side of the X axis. Our Surfer users are familiar with the thought of creating multiple maps and using an Overlay command to put the maps all onto a single set of axes. In Grapher, the Add to Graph commands make adding additional plots or axes easy. Create the base graph as above. In this example, instead of a line/scatter plot base, I will use a bar chart base. So, I would choose the Graphs | Add to Graph | Plot command, and choose Bar Chart. After selecting the worksheet, the default graph will be displayed. Change any properties of the plot desired.
Adding a second overlaid Y Axis
With any part of the graph selected, choose Graphs | Add to Graph | Axis. In the Axis Type dialog, select Y Axis and click OK. This axis will be placed to the right of the existing X Axis 1. So, verify that the drop down list shows X Axis 1 and the Position shows At the right of... Check the box Flip tick marks and labels to put the labels on the right side of the axis and click OK. Your new Y axis is created.
Adding a second plot
Now that you have a second axis, you can add your second plot. With any part of the graph selected, choose Graphs | Add to Graph | Plot. In the Select Plot Type dialog, select Line/Scatter Plot and click OK. In the Choose Axes dialog, select X Axis 1 and Y axis 2 and click OK. Select the worksheet and click Open. The plot is displayed with the default settings. You can change any portion of the plot by clicking once on it to select it and using the Property Manager.
This graph shows overlaid bar and line/scatter plots -
plots that use the same page location but different axes.
Scaling multiple graphs to fit
Occasionally, the plots will be directly on top of one another. This could obscure important information on one graph. So, you would need to alter the scale of one graph. In this case, we will make the bars longer. Select the Y Axis 1 in the Object Manager or click on the left Y axis in the plot window. In the Property Manager, click the Axis tab. In the Limits section, change the Maximum value to half its current value. This will enlarge the bars to twice their original heights. This also allows additional space to add more curves or other information.
This graph shows different scales on the two axes.
Conclusion: Creating more complex graphs
Combining the two types of graphs mentioned here (stacked and overlaid), you can create any number of complex graphs in Grapher. In addition to adding extra plots or axes, you can add legends, text boxes, and other drawn objects. You can also create entirely new graphs, such as pie charts or polar plots to add detail to an existing complex graph. An example is below.
A complex graph showing multiple variables
on stacked and "overlaid" axes.
If you have any questions about Grapher or this article, please contact us at firstname.lastname@example.org.