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.
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:
Select Graph Bar Chart from the main menu, as shown in Figure 5.1.
The Bar Chart dialog box appears. (See Figure 5.2.)
Select the category variable, and click Set X.
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.
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.