Follow

How can I create a stacked graph with multiple Y axes in Grapher?

To create a stacked graph with multiple Y axes, you can add additional plots to the graph and add additional axes. Axes can be linked so that they stay in the same relative location, if desired. To create a graph with 1 horizontal X axis and 2 stacked Y axes, follow these steps:

 

Creating the Bottom Plot and Axes:

  1. Create the appropriate bottom graph. For instance, if the bottom graph should be a bar chart, click the Graphs | Create | Bar | Vertical Bar Chart command (Bar Chart Button).
  2. Select the data file and click Open. For this example, I selected the bar chart orientations.dat file located in the Grapher Samples directory. The base graph is created.
  3. Normally, when you have two stacked Y axes, you want both axes to be shorter, so all the data fits on one page. Click on the Y Axis 1 to select it.
  4. In the Property Manager, click on the Axis tab.
  5. Change the Length to a smaller value. For a normal portrait page layout, you may want to make this 3-4 inches in length.
  6. Make any other changes to the Bar Chart 1, Y Axis 1, or X Axis 1, as desired. For instance, I have changed the X axis limits and the color and width of the bar chart in this example.

A bar chart graph is displayed in Grapher.
The original graph contains 1 X axis, 1 Y axis, and 1 plot.

 

Adding a New Y Axis:

  1. Click anywhere on the graph to select it.
  2. Cilck the Graphs | Add to Graph | Axis command (add an axis to a graph).
  3. In the dialog, select Y Axis and click OK.
  4. In the axis drop-down, select Y Axis 1. Ensure that At the top of is selected and click OK. The new Y axis is created.
  5. Click on the Y Axis 2 to select it.
  6. In the Property Manager, click on the Axis tab.
  7. Change the Length to a smaller value. For a normal portrait page layout, you may want to make this 3-4 inches in length.
  8. If desired, change the Y position value to a slightly greater number. This will add a space between the two axes.

 

Linking the Y Axes (optional):

  1. To keep the new Y axis in the same relative location, click on the Link Axis tab.
  2. Change the Link axis option to Y Axis 1.
  3. Check the boxes next to Link X position and Link Y position. Now, when the bottom Y axis moves, the top Y axis will, as well.
  4. If the axes should always be the same length, check the Link length box. When the bottom Y axis length changes, the top one will, as well.

 

Adding a New Plot to the Upper Y Axis:

  1. Click anywhere on the graph to select it.
  2. Click the Graphs | Add to Graph | Plot command (add a plot to a graph).
  3. Select the type of plot and click OK. For instance, you may select a Line/Scatter Plot.
  4. In the Choose Axes dialog, change Y Axis 1 to Y Axis 2 and click OK.
  5. Select the data file and click Open. The new plot is added to the original X axis and the top Y axis.

 Stacked Graph with 2 Y Axes
A stacked graph is created with 2 Y axes and 1 X axis. Both the line plot and bar chart use the bottom X axis.

 

Updated October 3, 2016

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.