KNOWLEDGEBASE - ARTICLE #1741

Prism 3 -- Creating a bar graph

Step-by-Step Examples:
Creating a Bar Graph in Prism 

This example shows how to make a bar graph using Prism. The method shown here must be used to graph data containing two grouping variables. A second method, the column bar graph – preferable when your data has only one grouping variable – is discussed in another step-by-step example Creating a Column Bar Graph. Once we've created and formatted our bar graph, we'll discuss some techniques for making bar graphs more understandable.


Create the Table

When you launch Prism, the Welcome to Prism dialog appears. It lets you create a new project (file) or open an existing one. Choose to Create a new project and to Work independently.

The lower portion of the Welcome dialog presents choices for formatting the first data table. For the X column, select Text (bar graph). For the Y columns, choose …replicates to calculate error bars and make sure that the number box is set to 3. Uncheck the option box at the bottom of the Welcome dialog to Pop up new user hints. Click OK to exit the Welcome dialog. Prism creates and displays the new table.

Since we chose Text (bar graph), the table contains an X column. Prism knows that the X column will contain categories expressed in text, and it will make a bar graph by default. And since we formatted the Y columns for 3 replicates to calculate error bars, Prism subdivides each data set (A, B, C, ...) to make room for our replicates (Y1, Y2, and Y3).

Click on the default table name (drop-down list in the middle row of the toolbar)…

…and rename the table. The name that you choose ("GP-13062" in our example) will be used as the title for your graph.


Enter the Data

Enter the values show below into your table. Be sure to include column headings, which you will substitute for the default entries "X Labels" and "Title".

You can change the number format on a Prism table. Select all of the columns you wish to change, then click Change…Number Format.


View the Graph

As soon as you have entered your data, Prism creates a graph automatically. Look again at the Explorer. If you began this example in a new Prism project file, your graph carries the default name Graph-1:Bar Chart. Click on that name, or click on the yellow Graphs tab (tool bar), to view the graph.

Prism automatically graphs all the data sets (columns A and B) on the data table. You may easily add or remove data sets from the graph (click Change…Data on Graph…).

Note carefully how the information on your data table is used to create the bar graph:

  • Text labels in the X column ("Placebo", etc.) are placed beneath the appropriate group of bars, although you can modify that as discussed below.
  • Labels for the data sets ("Pre-treatment", etc.) are placed in the legend, where they identify the data sets by color/pattern. As always, Prism plots data from the same data set using the same color and pattern. To change colors, patterns, and borders of the bars, double-click on one of the bars to open the Format Bars dialog.
  • The X column heading becomes the horizontal "axis" title.
  • The name of the data table becomes the title of the graph.
  • Error bars are produced automatically. Prism averages replicate values and plots the mean and standard error of the mean.

Format the Graph

Refer to the illustration of the graph below as you make these format changes:

To: Do this:
Make the axes thicker Click on the Change button and choose Thickness of Axes and Frame. Select a thicker setting.
Change the bar appearance Double-click on a bar to bring up the Format Bars dialog. Change fill color, fill pattern, and border thickness.
Change the axis numbering Double-click on the Y axis to bring up the Axes dialog. Click on the box labeled Auto to deselect it. Then change the tick interval and add minor ticks.
Move the legend Click on the "Pre-treatment" legend to select it. Hold the Shift key and click on the "Post-treatment" legend to select it also. Drag both legends on the graph to move them.
Frame the legend Click the rectangle tool and draw a box around the legends.
Edit the Y axis title Click on the default Y-axis title; the text will flip to horizontal. When done, click anywhere on the graph to flip it back. Use the formatting buttons in the third row of the tool bar to enter Greek letters.
Convert the error bars from SEM to SD Double-click on a bar to bring up the Format Bars dialog. Check the All box to make a global change to all data sets on the graph, and click on SD error bars. Increase the thickness of the bars.


Techniques for Making Bar Graphs more Understandable

Rearranging Bars

To change how the bars are arranged, double-click on one of the bars to open the Format Bars dialog.

You can interchange between vertical and horizontal bars using the settings near the top of this dialog.

You can also modify the order in which the bars are shown. In our example, the data contains two grouping variables: (1) treatment, with the values "Placebo," "10 mg," and "100 mg" placed in the X column as text entries, and (2) time, with values "pre-treatment" and "post-treatment", differentiated by data set. When there are two grouping variables, you can choose among interleaved, stacked, or separate bar arrangements, as shown below. You can also choose a custom arrangement (a mixture of arrangements, not shown).


Transposing Data

The way Prism draws and groups bars depends upon how data is arranged in the table. All bars from the same data set have the same color and fill pattern. If the distinction between different bar appearances and different bars of the same appearance isn't what you want, try transposing the data table. From the data table view, click Analyze, choose Data manipulations… Transpose X and Y, and check the option to create a new graph of the results. Your original data table and graph are not modified, but the transposed table is produced on a "results" sheet and a new graph of the transposed data is created. If, for example, you transform this data table…

to produce this results sheet…

…Prism assigns colors and patterns to the bars in the same way before and after transposing, but since columns and rows are interchanged, so is the color/pattern scheme. Here is the new graph:

This may be useful even when your data has only one grouping variable, as in the example below. In this instance, you can use transposition to switch between having all bars shown in the same way and having bars shown differently.


Spacing: Uniform Changes

You can change the horizontal spacing of bars from the Format Bars dialog:

Here is the effect of a decrease in the gap between bars (note that the bars widen in the process):


Spacing: Custom Changes

Many users wish to introduce additional spacing into a bar graph to isolate one group of bars in particular – not to be confused with the "additional gap" offered in the dialog shown above, which is placed between all groups. You can create this extra space by inserting an empty row in the data table in the appropriate place. For example, inserting the empty row (2) in the following data table…

…produces this change in the graph:

Note that this works only for a regular bar graph (text in the X column), not a column bar graph (no X column).

Remembering that Prism shows values in any given data set in the same way suggests another way single out one, or a few, bars to be shown differently. You can always change a bar or symbol appearance by moving data to another column (data set). Thus this table…

…leads to this graph:

The problem with this approach is evident if you look closely at the relative spacing of the bars and the alignment of bars with text labels. Prism leaves space for the "missing" bars, that is, it interprets the empty cells as if they contained zeros. A better solution may be to set up your table to make an XY graph (format X column for Numbers), as show below.

Here, the X coordinate determines the horizontal position of the symbols. The resulting graph will show your values as point symbols, but you can change those symbols to "spikes" (in the Format Symbols and Lines dialog, drop down the Shape list box and make the fourth choice from the bottom). Finally, change the numbers along the X axis to text labels using "custom ticks" (double-click on the X axis, then choose Custom Ticks). Here are the custom tick settings for this example:

Here's the graph:


Alternatives to Bar Graphs

We've just shown an example of using an XY graph that actually looks like a bar graph to solve a bar-spacing problem. This technique is useful anytime you want to show data using bars, but you want to position the bars horizontally according to the value of an X coordinate rather that spacing them evenly. It's also useful for graphs that contain both bars and lines. Here are some examples:

  1. Combining bars and lines on the same graph is demonstrated in another step-by-step example, Combining a Bar Graph with a Line Graph.
  2. Creating a histogram, particularly when you wish to superimpose a line showing an ideal frequency distribution.
  3. Creating a mass spectograph, where symbols on the XY plot are replaced by "spikes", or bars of zero width.

Finally, another alternative to ordinary bar graphs, the column bar graph – recommended when your data has only one grouping variableis illustrated in Creating a Column Bar Graph.

Explore the Knowledgebase

Analyze, graph and present your scientific work easily with GraphPad Prism. No coding required.