How is the plot different when hue is "Age Range" and x is "Gender"?



In the context of this exercise, how is the plot different when hue is “Age Range” and x is “Gender”?


Let’s step through what happens when we change each parameter value.

First, if we change the x value to be “Gender” instead of “Age Range”, the data will be split mainly by the two possible values under the “Gender” column, which are “Male” and “Female”, resulting in two main sections in the bar graph that the results are shown by.

Next, when we apply a hue of “Age Range” to the barplot, it will split the data further on the specified hue values. This will further categorize the two sections (Male and Female) into 4 bars, one for each age range (18-25, 25-35, 35-45, 45+).

If you observe how the plot for step 1 in the instructions appears compared to this graph, you might notice that both have a total of 8 bars. The method we applied in step 1 will have 4 groups of 2 bars each, because we first split by “Age Range” (4 values), then further split by “Gender” (2 values). You may also see that the values of each individual bar is the same in both methods, just that the presentation and grouping of the bars is different.