Example: Create a Bar Chart

In this section you create a bar chart of the category variable of the Hurricanes data set. The category variable gives the Saffir-Simpson wind intensity category for each observation.

The category variable is encoded according to the value of wind_kts, as shown in Table 5.1.

Table 5.1 The Saffir-Simpson Intensity Scale

Category

Description

Wind Speed (Knots)

TD

Tropical depression

22–33

TS

Tropical storm

34–63

Cat1

Category 1 hurricane

64–82

Cat2

Category 2 hurricane

83 –95

Cat3

Category 3 hurricane

96 –113

Cat4

Category 4 hurricane

114 –134

Cat5

Category 5 hurricane

135 or greater

The category variable also has missing values, which represent weak intensities (wind speed less than 22 knots).

To create a bar chart:

  1. Open the Hurricanes data set.

  2. Select Graph Bar Chart from the main menu, as shown in Figure 5.1.

    Figure 5.1 Selecting a Bar Chart
    Selecting a Bar Chart

    The Bar Chart dialog box appears. (See Figure 5.2.)

    Figure 5.2 The Bar Chart Dialog Box
    The Bar Chart Dialog Box

  3. Select the category variable, and click Set X.

  4. Click OK.

Note:The bar chart also supports an optional frequency variable.

A bar chart appears (Figure 5.3), which shows the unique values of the category variable. The chart shows that most of the observations in the data set are for tropical storms and tropical depressions. There are relatively few category 5 hurricanes.

Figure 5.3 A Bar Chart
A Bar Chart

The category variable has missing values. The set of missing values are grouped together and represented by a bar that is labeled with the symbol.

You can click a bar to select the observations contained in that bar. You can click while holding down the CTRL key to select observations in multiple bars. You can draw a selection rectangle to select observations in contiguous bars.

You can create bar charts of any nominal variable, numeric or character.