Important updates to Golden Software support policy and benefits

Dual Device Activations • Expert Technical Support • 1:1 Guided Zoom Sessions

Tutorial: Creating a Combination Chart in Grapher

 

Field sensors across the world are constantly monitoring rainfall and water quality. The graph we’ll be creating today, analyses the relationship between precipitation and nitrogen levels during an imagined storm event, that temporarily breaches local regulatory limits.

Whilst this case study is very specific, it’s easy to imagine how the same process could be applied to hundreds of different datasets. Want to follow along? Download the sample dataset used in this tutorial and get started below.

 

Part 1: Understand the data

When working with any dataset, it’s important to understand how your data is structured before beginning any analysis.

  1. Start Grapher, and click File | Open Worksheet. Select the downloaded NitrogenLoadDuringStormEvent file and review the rows and columns.

Which ones do you think we’ll need to use once we begin creating our graph?

Column
Header Details Role in Plot
A

datetime

Continuous (96 hrs)

Shared X-Axis for both panels

B

precipitation_mmhr

15-minute readings

Top panel: Inverted continuous line

C

organic_n_mgl

4-hr / 1-hr intervals

Bottom panel: Base stacked bar (Light Blue)

D

ammonia_n_mgl

4-hr / 1-hr intervals

Bottom panel: Middle stacked bar (Pink)

E

nitrate_n_mgl

4-hr / 1-hr intervals

Bottom panel: Top stacked bar (Purple)

F

total_n_mgl

Calculated sum

QC check for 2.5 mg/L threshold exceedance

Notice that column B is left aligned, which means Grapher is reading that column as text and won’t be able to interpret it properly.

  1. To fix column B, highlight the Column, then click Data | Data | Text to number. Now all the columns are right aligned as expected.

TextToNumber.png
  1. Click File | Save | Save, to save your changes and close the worksheet pane.

Tip: If you ever have data that doesn’t show up on the graph as expected, check the worksheet in Grapher to confirm the values and formatting

Part 2: Create the bar chart

We’ll start by working on the stacked bar chart that will show the nitrogen readings.

  1. Navigate back to your empty plot, and click Home | New Graph | Bar | Vertical Bar Chart

  2. Select the data file NitrogenLoadDuringStormEvent.csv and click Open

By default Grapher assumes column A is the X axis, and column B is the Y Axis, but in this case we’re more interested in column C

  1. Make sure precipitation_mmhr is selected in the Object Manager. In the Property Manager, navigate to Plot | Data | Y Variable. Click the drop down and select Column C.

Whilst we’re here, we can adjust the graph to make the bars wider. Once the width is set up how we want it, we’ll stack the two other sensor readings on top

  1. Navigate to Plot | Plot Options. Expand the Width settings, and set the Bar width to 100%.

  2. In the same Plot tab, under Add to Graph, click [Create] twice. Once for the organic_n_mgl column and once for the ammonia_n_mgl column.

Let’s adjust our date axis so it more clearly communicates the range in our data. We want the major axis to indicate the day, and the minor axis to indicate every 8 hours.

  1. In the Object Manager, select X Axis 1.

  2. In the Property Manager, under Ticks | Major Ticks, click the checkbox to use date/dime spacing.

  3. Beneath it, click the [Every Year] button next to Date/time spacing.

  4. Set the dialog to Every 1 day then click OK.

  5. Whilst we’re here, we’ll update the minor ticks too. Use what you’ve learned to enable the use date/time spacing checkbox for minor ticks, and update the date/time spacing for minor ticks to Every 8 hours.

  6. Check the Coincident major/minor ticks box

Now we’ll update our labels too:

  1. To update the label formatting, navigate to the Labels tab, and under Major label date/time format, click [Select].

  2. Paste “MMM-dd” into the Date/Time format, click OK.

  3. Under the General tab, click the checkbox to Show minor tick labels and click the [Select] button next to Minor label date/time format.

  4. Paste “HH:mm” into the Date/Time format, click OK

  5. Under Label Settings, make sure Major Labels is selected in the Labels to edit field. Set the Y offset to 0.25.

  6. Click the dropdown menu in the Labels to edit field and select Minor Labels. Update the Y offset to 0.

Finally, we’ll update our Axis extents, since we don’t have any data outside of the Oct 12th - Oct 16th period.

  1. Navigate to the Axis tab in the Property Manager of the X Axis, and under the Limits heading, click the […] button next to Minimum date/time. Update date to Oct 12, and click OK.

  2. Click the […] button next to Maximum date/time, and update date to Oct 16. Click OK.

Part2.png
Part 3: Add local regulatory limit line

Since we know the regulatory limit is a constant 2.5 value, we can use a function plot to represent this limit.

  1. In the Object Manager, click the Green plus icon next to Graph 1. In the Select Plot Type window select Function Plot- Y = F(X), and click [OK].

  2. With the function plot selected in the Object Manager, navigate to the Plot tab in the Property Manager. Under Plot options, set Y = F(X) = to 2.5

Now we’ll adjust the formatting to make this line stand out.

  1. In the Line tab, set the Color to Red and the Width to 0.05.

Part 4: Include a Legend

To be able to effectively communicate which colors relate to which nitrogen entries, we’ll add a legend.

  1. In the Object Manager, select Graph 1. In the ribbon, navigate to Graph Tools | Add to Graph, and click Graph Legend.

We’ll also update the entries for the three different measurements to make them more legible.

  1. Select the legend in the Object Manager. In the Entries tab of the Property Manager, under Individual Entries, click the Entry dropdown, and select nitrate_n_mgl

  2. Rename it in the Text field to Nitrate Nitrogen (NO₃⁻)

  3. Use what you’ve learned in step 2 to repeat the same process for the next two entries. Update ammonia_n_mgl to Ammonia Nitrogen (NH₄⁺) and update organic_n_mgl to Organic Nitrogen

  4. In the Entries tab under Reorder/select entries, click [Edit]

Visually, it would make the most sense for the order of the legend, to match the order that we see in the graph. We’ll update our legend, and remove the regulatory limit entry whilst we’re here.

  1. Uncheck Regulatory Cap (2.5 mg/L), then click and drag Nitrate Nitrogen (NO₃⁻) to the top of the list. Click and drag Ammonia Nitrogen (NH₄⁺) to second in the list and click OK.

  2. Under the Title tab, change the Legend text to Nitrogen Species

Part4.png
Part 5: Update the Axis

Before adding our second Y axis, we’ll make some improvements to our existing one, starting with the title.

  1. With the Y Axis selected in the Object Manager, click on the Title tab. Under Text, click the Pencil. Replace the text with Total Nitrogen Concentration (mg/L) and click OK.

We can remove the title of the X axis, since the date and time are self explanatory.

It's important to always consider the cognitive load that different parts of the graph can add. This is the difference between someone seeing a graph and immediately understanding it, versus having to spend 3 minutes working out what it means. Along the way, we’ll try to remove unnecessary clutter as much as possible.

  1. Select the X Axis 1. In the Property Manager, click on the Title tab and in the Text field, delete the text.

  2. In the Plot window, select the X axis and drag it horizontally to ~ 2x the current size. This way it will take up the full width of a piece of paper when we eventually export it.

Before we move on, we’ll update the name of our axis in the Object Manager to help reduce confusion later on.

  1. In the Object Manager, right click Y Axis 1. Click, Rename, and update the name to Y - Nitrogen

Now, we can add a second Y Axis to show precipitation from the storm.

  1. Make sure Graph 1 is selected in the Object Manager, and in the ribbon, navigate to Graph Tools | Add to Graph | Axis | Y Axis.

  2. In the Position Y Axis 2 window that opens, select At the right end of…, then check the boxes to move X only, and to Flip tick marks and labels. Click [OK].

  3. Use what you learned in step 4 to rename Y Axis 2, to Y - Rainfall

  4. With Y - Rainfall selected in the Object Manager, navigate to the Title tab of the Property Manager and set the Text to Precipitation Rate (mm/hr)

  5. Zoom out in the Plot window, and click and drag the new axis above the graph

Part5.png
Part 6: Import Precipitation data

With our axis set up, we’re ready to add our final column of data from our worksheet.

  1. In the Object Manager, click the Green plus icon next to Graph 1. In the Select Plot Type window select Line Plot, and click OK.

  2. In the Choose Axis window, set the X Axis to X Axis 1 and the Y Axis to Y Axis - rainfall and click OK.

  3. In the Open Worksheet window, look in the Open Worksheets box and select the same NitrogenLoadDuringStormEvent file we’ve been working with. Click Open.

Rainfall is typically displayed with a reversed axis. We can update this easily in Grapher.

  1. Ensure Y Axis - Rainfall is selected in the Object Manager, and navigate to the Axis tab of the Property Manager. Under Limits, click the toggle next to Reverse axis direction.

  2. In the same tab, ensure the Minimum limit is set to 0.

  3. In the Plot window, select the Precipitation Y Axis, and click and drag the green box at the top of the axis to shrink it vertically.

Part 7: Finishing Touches

There are just a few more touches this graph needs before it’s publication ready. We’ll add some parallel axis lines, update the legend, and add a title.

  1. Select X Axis 1 in the Object Manager and click on the Line Tab in the Property Manager. Under Grid Line Properties, click the checkbox for Major tick grid lines.

  2. Under Parallel Axis, select All Parallel Axes in the dropdown.

We also need to update the precipitation entry in our legend. Try doing this using what we learned in Part 4. If you need help, use steps 3 and 4 below.

  1. Select the legend in the plot document, and navigate to the Entries tab of the Property Manager.

  2. Click the Entry dropdown, and choose precipitation_mmhr. Update the Text field to Precipitation

Lets add some floating text for the peak nitrogen reading too.

  1. In the Home ribbon, navigate to Insert | Text and click anywhere in the Plot window to launch the Text Editor dialog. Paste Peak Nitrogen Exceedance 4.15 mg/L and update the text display. For example:

    • Font → Calibri

    • Size - 16

  2. Click and drag the text so that it sits at the top of the Nitrogen Peak

Finally, a good graph needs a title!

  1. Select Graph 1 in the Object Manager, and navigate to the Title tab in the Property Manager

  2. Uncheck the box next to Link to object name and click the pencil in the Text field.

  3. Paste an updated title Total Nitrogen Analysis on the first line, and a subtitle, Imagined Storm Event at Willow Creek Basin (Station 04-A) on the second line.

  4. Use what you learned in step 5 to adjust the text formatting for the title, making the subtitle slightly smaller.

  5. In the Title tab of the Property Manager, set the position to Left-Top in the dropdown menu.

Part7.png

 

 

 

 

Was this article helpful?
...

Comments

0 comments

Please sign in to leave a comment.