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:
- Create the appropriate bottom graph. For instance, if the bottom graph should be a bar chart, click the Home | New Graph | Bar | Vertical Bar Chart command (
).
- 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.
- Normally, when there are two stacked Y axes, both axes are shorter, so all the data fits on one page. Click on Y Axis 1 in the Object Manager to select it.
- In the Property Manager, click the Axis tab.
- Change the Length to a smaller value. For a normal portrait page layout, you may want to make this 3-4 inches in length.
- 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.
The original graph contains 1 X axis, 1 Y axis, and 1 plot.
Adding a New Plot with a new Y axis:
- Click anywhere on the graph to select it.
- Click the Home | Add to Graph | Plot command (
).
- In the Select Plot Type dialog, click your desired plot type and then click OK. For instance, you may select a Line Plot.
- In the Choose Axes dialog, change Y Axis 1 to Create new axis.
- Click the Position button.
- In the Position New Axis dialog, click X Axis 1 and select Y Axis 1. Ensure that At the top of is toggled and click OK.
- Click OK in the Choose Axes dialog.
- Select the data file and click Open. The new plot is added to the original X axis and a new Y axis positioned above the first Y axis.
- Click Y Axis 2 in the Object Manager to select it.
- In the Property Manager, click the Axis tab.
- Change the Length to a smaller value. For a normal portrait page layout, you may want to make this 3-4 inches in length.
- If desired, change the Y position value to a slightly greater number. This will add a space between the two 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.
Linking the Y Axes (optional):
- To keep the new Y axis in the same relative location, click on the Link Axis tab.
- Change the Link axis option to Y Axis 1.
- 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.
- 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.
Updated March 19, 2020
Comments
0 comments
Please sign in to leave a comment.