In the context of this lesson, when is each type of plot used?
A bar chart is used to show the frequency or count of data that fall under different categories. For example, showing the number of students in a university per major.
Side-by-side Bar Chart
These are used when there are multiple sets of data, sharing the same axis values. Taking the example for the bar chart above, we might have multiple universities, which we want to show the number of students per major, by university side-by-side.
Stacked bars are used when we want to keep track of the total between multiple sets of data. For example, if we needed to graph the total income for 3 items of a store which are “monitor”, “mouse”, and “keyboard”. The x values represent days of the week, and the bars represent income, with each “layer” being the income for an item. There would be 3 layers, and the total bar height for each day would be the total income of all items.
A histogram is used to show how many values in a dataset fall between different ranges of numbers, known as bins. For example, showing the number of people by age, where each bin is a range of ages (10-20, 20-30, …).
Pie charts are used when displaying the frequencies or fractions of data over the whole. For example, showing how much of the total money spent in a month is spent towards groceries, entertainment, gas, and loans. Each wedge of the chart shows the fraction of the total amount spent toward a certain expense.