TextEdit Icon

Bar Charts

PublishPlot has always been able to do bar charts, but they became a built-in feature in version 2.4. Although the built-in method is usually the best approach, the prior manual method is sometimes useful as explained and documented below.

TextEdit Icon

Built-In Bar Charts

One way to add a bar chart to an empty document or to a document that already has bar charts is to choose the Add Data Set... menu command (or click the add data set icon in the tool bar).

A better way to create bar charts is the same as for creating numeric plots. In brief, edit text in other software that follows the simple PublishPlot rules for a table of data. When done, copy and paste (or drag and drop) the text of the table to a PublishPlot document. The only difference for bar chart tables is the first column of data for the x axis must use text labels rather then numbers.

For a sample bar change, copy and paste the following table into a new window — it should create the plot shown below the table:

#setXTitle Material
#setYTitle "Internal Bond (kPa)"
#setSymbolLineWidth	0.25	0.25	
#setSymbolSize	6	6	
#setSymbolFillColor	gray blue	
#setName	IB-Dry IB-Wet
OSB	287	283
MDF	506	186
PB	562	330
Sample Bar Chart

Working with Bar Charts

Each PublishPlot document can be all numeric plots or all bar charts — they cannot be mixed. The follow list explains differences when working with bar chart documents:

TextEdit Icon

Manually Created Bar Charts

Because numeric plot and bar chart documents cannot be mixed, how can you handle superposing a numeric plot on a bar chart. Consider the following example. The bar chart for "Control", "Better", and "Best" could easily be created with built-in bar chart methods, but this plot also helps to visualize the data by plotting raw data points spread across the bars for visibility. Such a plot requires a numeric plot.

Manual Bar Chart

Creating such a plot that combines bar charts with numeric data is a two step process:

  1. First create a bar chart within a numeric plot. The process is described below. It was the only method available for bar charts prior to version 2.4. It is a method that still works and is now only needed when you want to mix numeric plots with bar charts.
  2. Once the bar chart is created in a numeric plot document, you can add any numeric plots you want to that document. The above example adds a plot of raw data points.

The basic steps to manually create bar charts within numeric plot documents are as follows:

  1. Create a plot with bar chart data. The numeric x values for vertical bar charts should be equally spaced (such as 1,2,3,...). For horizontal bar charts, the numeric y values should be equally spaced instead.
  2. Select "Vertical Bars" or "Horizontal Bars" for the symbol type (as appropriate for bar direction) of your plot. Normally you select "No Line" to plot bars by themselves without connecting them with lines.
  3. For desired appearance, set the symbol size to change the width of the bars. You also can fill the bars with a color or a pattern.
  4. Change the bar axis minimum and maximum to adjust spacing to the left and right of the bars. Remove the axis title (if desired) and set color of tick labels to match the background color (because the equally-spaced numerical values may not be relevant).
  5. To label bars, add plot labels. If you want the bar labels to be under the bars when using "Vertical Bars", turn off "Automatic" ranging for the y axis and then drag the labels to the space below the plot. Similar methods can be used to place labels to the left of "Horizontal Bars," but the space available is more limited.
  6. You can add error bars to your plot data or use statistics to plot standard deviation bars for groups of data at each bar location.