StatCrunch logo (home)

< StatCrunch Examples
Creating simple bar plots with raw data
This tutorial covers the steps for creating simple bar plots in StatCrunch. To begin, load the Two Categorical Variables data set, which will be used throughout this tutorial. This toy data set contains only two columns of data. The data in the var1 column, which will be used in this tutorial, contains 10 total values with the value b in the first four rows and the value a in the last six rows. This data set is in raw form in that it is not summarized with values in one column and counts/frequencies in another column. To construct bar plots with data in summary form see Creating simple bar plots with summary form.
Creating a bar plot with frequency on the y-axis
By default, StatCrunch will plot the frequency or count of each unique value in a selected column on the y-axis. For example, to create a bar plot of the data in the var1 column, choose the Graph > Bar Plot > With Data menu option. Select the var1 column and click Compute!. The y-axis on the bar plot shown below indicates a frequency of six for the a values and a frequency of four for the b values.
Creating a bar plot with relative frequeny or percent on the y-axis
For bar plots involving only one column, StatCrunch can also tally the relative frequency (proportion) or percent (of total) associated with each unique value on the y-axis. These items are available under the Type option. For example, in the window containing the resulting bar plot above, choose Options > Edit to reopen the bar plot dialog window. Change the Type option to Percent and click Compute!. The resulting bar plot below shows the percent of the values in the var1 column taking on the value of a (60%) and b (40%).
Changing the ordering of values on the x-axis
Under the Order by option, StatCrunch offers a number of different methods for ordering the values on the x-axis. The default Value Ascending ordering places the a value before the b value in a standard alphabetical a to z ordering. The Value Descending method reverses this ordering. For example, in the window containing the resulting bar plot above, choose Options > Edit to reopen the bar plot dialog window. Change the Order by option to Value Descending and press Compute!. Now the b value is placed before the a value. Note this is also the case if Worksheet order is used since b appears before a in the var1 column. The Count Ascending and Count Descending options can be used to order the values on the x-axis based on the frequencies associated with the values rather than the values themselves. Note the Count Descending option can be used to construct a bar plot in standard Pareto form with decreasing bar heights (frequencies) from left to right. 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 var1 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 bar plot can be quite messy with little room to properly label all of the values on the x-axis. 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 bar plot above, choose Options > Edit to reopen the bar plot 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 b value only makes up 40% of the var1 column. 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.
Displaying values above the bars
StatCrunch can also be used to display the tallied numerical values above each of the bars. As an example, in the window containing the resulting bar plot above, choose Options > Edit to reopen the bar plot dialog. When the dialog window reappears, turn on the Value above bar option by checking the associated box under Display and click Compute!. The resulting bar plot shown below now displays the percents associated with both the a and b (relabeled as Other*) values. Note a value may be suppressed if there is not enough room to display it above the corresponding bar.

Always Learning