StatCrunch logo (home)

< StatCrunch Examples
Creating pie charts with summary data
This tutorial covers the steps for creating pie charts in StatCrunch with summary data. To begin, load the Categorical Variable In Summary Form data set, which will be used throughout this tutorial. This toy data set contains only two columns of data. The var1 column contains the unique observations of a categorical variable. The Counts column contains the number of times each associated value in the var1 column was observed. In this case, the value b was observed four times, and the value a was observed six times. In StatCrunch jargon, this data set is in summary form. To see an example of constructing pie charts with this data in raw form see Creating pie charts with raw data.
Creating a pie chart
To create a pie chart of this summary data, choose the Graph > Pie Chart > With Summary menu option. Select the var1 column under the Categories in option, select the Counts column under the Counts in option, and click Compute!. The resulting pie chart is shown below with a legend tabling the values associated with each color in the chart as well as the count and percentage (of total) associated with each value. Note that the colors assigned to the values are determined by the color scheme selected for the pie chart. The pie chart shown below uses the default StatCrunch color scheme.
Controlling the legend display
The count and/or percent of total associated with each value can be tallied in the legend. For example, to alter the output above to only display the percent of total for each value, choose Options > Edit to reopen the pie chart dialog window. Change the Display options by deselecting Count and then click Compute!. This option can be deselected with a Ctrl+Click on Windows or Cmd+Click on a Mac. Alternatively, the mouse can be clicked and dragged to select the desired options. The resulting pie chart shown below only displays the percent of total in the legend.
Controlling the display of the slices
Under the Order by option, StatCrunch offers a number of different options for ordering the slices associated with each value. The default Value Ascending ordering places the a value before the b value using a standard alphabetical a to z ordering. The first slice is drawn at the default Start angle of 0 degrees in trigonometric terms. This corresponds to roughly 3 o'clock when thinking of the circle as a standard clock. The slices are then drawn in a counter clockwise direction based on the ordering selected. The display of the slices can be controlled by changing the Order by and Start angle options. For example, consider changing the above pie chart so that the b value appears before the a value and the slices start at 90 degrees (12 o'clock). In the window containing the resulting pie chart above, choose Options > Edit to reopen the pie chart dialog window. Change the Order by option to Value Descending, which will reverse the default alphabetical ordering, enter 90 for the Start angle option, and then press Compute! to obtain the pie chart with the desired characteristics shown below. Note the same display could be obtained with a Worksheet order since the b value appears before the a value in the var1 column. The Count Ascending and Count Descending options can be used to order the slices based on the frequencies associated with the values rather than the values themselves. In this example, changing to the Count Descending option will revert the values back to the original ordering because the a value has a higher frequency than the b value in the Counts column.
Combining all values with small relative frequencies into a single Other* category
In situations where a selected column has a few values which occur frequently and a larger number of values that do not occur often, the resulting pie chart can be quite messy with little room to properly label the values on each slice. In such cases, it is often times advantageous to combine the values with low relative frequencies into a single Other* category using the "Other*" if percent less than option in StatCrunch. To illustrate, in the window containing the resulting pie chart above, choose Options > Edit to reopen the pie chart dialog window. Change the "Other*" if percent less than option to 50 and click Compute!. In this case, the b value is simply relabeled as Other* since the count of b values only makes up 40% of the total. While probably not a great idea for this data set, this change shows how StatCrunch can create a catch all category (Other*) by combining all categories with an associated percent of total below a specified threshold. The Other* category is also always displayed last in the ordering.

Always Learning