A bar graph of a qualitative data sample consists of vertical parallel bars that shows the frequency distribution graphically.
In the data set painters, the bar graph of the School variable is a collection of vertical bars showing the number of painters in each school.
Find the bar graph of the painter schools in the data set painters.
We first apply the table function to compute the frequency distribution of the School variable.
> school = painters$School # the painter schools
> school.freq = table(school) # apply the table function
Then we apply the barplot function to produce its bar graph.
The bar graph of the school variable is:
To colorize the bar graph, we select a color palette and set it in the col argument of barplot.
+ "orange", "blue", "pink", "cyan")
> barplot(school.freq, # apply the barplot function
+ col=colors) # set the color palette
Find the bar graph of the composition scores in painters.