Follow

Creating and Using Bar Charts in Grapher

Grapher has the ability to display bar chart data in multiple layouts. Bars with the same coordinates can be stacked on top of one another or they can be adjacent to each other. In order for bars to be grouped like this, the value of the bar location needs to be identical. For vertical bar charts, this would be the X value; for horizontal bar charts, this would be the Y value.

This article discusses data layout for bar charts, creating grouped bar charts and displaying the bars as adjacent or stacked, creating grouped bars from multiple data files, and using images for bar chart display.

Creating Data for Bar Charts
Bar charts are plotted from columns of data. Each column is plotted as a single bar chart plot, with each row being a new bar chart. Therefore, each row should have a different bar location value. For a vertical bar chart, this means that each row has a different, unique X value. For horizontal bars, each row would have a different, unique Y value. This example data will generate bars that are evenly spaced 1 month apart:

 

Data Layout for Bar Charts
The table shows three columns: Month, Kwh/mon 2009 and Kwh/mon 2008.
Using Month as the unique value will have bars spaced evenly at a one month interval.

Creating Grouped Bar Charts from the Same Worksheet
To create the first bar chart, click the Graphs | Bar | Vertical Bar Chart command. Select the data file and click Open. The bars are automatically created. To add a second bar chart using column C, follow these steps:

 

  1. In the Object Manager, click on the Bar Chart 1 object.
  2. In the Property Manager, click on the Plot tab.
  3. Scroll all the way down and click the Create button next to New Plot. The second bar chart is automatically added from column C. When the data is in the same worksheet and created using the Create New plot command, the bars are automatically grouped together.
  4. Click on the Fill tab to change the color of the newly created bar chart so that each set of bars are separate colors.
  5. These bars can either then be stacked or adjacent. To switch between stacked and adjacent bars, click once on either bar chart to select it.
  6. In the Property Manager, click the Plot tab.
  7. Change the Stacking property to the desired option.

     

    Stacked Bar Plots Adjacent Bar Plots
    The bar charts on the left are stacked. The bar charts on the right are adjacent.

     

Creating Grouped Bar Charts from Multiple Worksheets
If your data is contained in multiple worksheets, you can still group data. For instance, here is a second data set that I would like to compare to my original data:

 

Second Bar Chart Data File
Average energy usage per month for focus area.

This data contains energy usage averages for our focus area. To compare the kilowatt hours from the original data set with this data, use these steps:

  1. Click the Graphs | 2D Bar | Vertical Bar Chart command. Select the original data file and click Open. The bars are automatically created.
  2. To add the second bar chart using the new data file, click Graphs | Add to Graph | Plot.
  3. Select Bar Chart and click OK.
  4. Click OK in the Choose Axes dialog, selecting the same axes.
  5. In the New Worksheet dialog, select the new worksheet and click Open. The second set of bars is automatically created.
  6. Click on the Fill tab to change the color of the newly created bar chart so that each set of bars are separate colors.

Notice that the second set of bars is overlaying the first set. Since we want the bars to be adjacent, we will need to force the two data sets to be a single group.

  1. In the Object Manager, click on either the Bar Chart 1 or Bar Chart 2 object.
  2. In the Property Manager, click on the Bar Chart Groups tab.
  3. In the list of plots under Group 1, check the boxes next to Bar Chart 1 and Bar Chart 2. The bar charts are now grouped.
  4. These bars can now be stacked or adjacent. To switch between stacked and adjacent bars, click once on either bar chart to select it. In the Property Manager, click the Plot tab. Change the Stacking property to the desired option.

     

    Grouped Bars from Different Worksheets
    Bar charts can be grouped so that they can be stacked or adjacent,
    even when the data comes from different worksheets.

     

Using Images for Bar Chart Fill
In Grapher, any image can be used to fill the bar chart. So, instead of blue and red solid filled rectangles, bar shapes can be cones, diamonds, spindles, or images. To change the bars to images:

  1. Click on the bar chart in the Object Manager.
  2. In the Property Manager, click the Plot tab.
  3. Change the Bar style to Image.
  4. Click the Load button next to Set image.
  5. In the Set Image dialog, click the Load Image button.
  6. In the Import dialog, select the image and click Open.
  7. Change the Repeat image option to allow the image to stack.
  8. Check the Use full image option to only allow the full image to stack. Without this option, you may have partial images to make the full height of the bar.
  9. Click OK to make the change to the graph. The bars will automatically update to show the image.

 

Oil Can Image for Energy Consumption Graph
Using an image for bar chart fill increases the effectiveness of your graph.
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.