1. Point and count plots
Let's take a look at a couple more catplot visualizations, the point and count plots.
2. Point plot example
Seaborn's catplot is a great starting point for building visualizations based on categorical variables. For this next plot, we again only need to update the kind parameter. Using the reviews dataset one more time, let's look at the review scores given whether the hotel has a pool or not.
The point plot shows the mean of the reviewer score just as a bar plot does. However, the diagonal line that connects the means helps users see the difference between them and is often more helpful when there are more categories displayed. The points show means of the score across the categories of pool, while the blue bands that go through the mean represent the confidence intervals. Reviews for hotels without pools hover around 3-point-2, while reviews for hotels with pools hover around 4-point-2.
3. Bar plot vs. point plot
When creating visualizations using only one categorical variable, the two visualizations are quite similar. However, the point plot may help users focus on the different values across the categories by adding a connecting line across the points, while the y-axis is changed to better focus on the points. The bar plot, however, may have a more familiar look and does provide color differences even if only one categorical variable is used. The y-axis for this visual defaults to starting at 0. Let's take a look at one more plot that uses the hue parameter.
4. Point plot with hue
Notice that the two colored lines go in opposite directions. Having a tennis court or not makes a big difference for hotels with no Spa, but hotels with Spas seem to receive similar reviews regardless of if they have a tennis court.
In this visualization, we have set the dodge parameter to true. This offsets the lines so that they don't overlap and makes it easy for users to see where the mean and confidence intervals fall.
5. Using the join parameter
Sometimes we might not want to join the estimators of each line. We can turn this off using the join parameter. By setting join equal to false, the lines are no longer connected. In this visual, we put the score along the x-axis, and the review weekday along the y-axis. Did you notice the terrible order of the weekdays? That's because we didn't set the order of the review weekday variable! We'll fix that in one of the exercises.
6. One last catplot type
Throughout this course, we have used value-counts to view frequency tables. Value counts are usually shown using a bar plot, but we have already discussed what the seaborn catplot method does when specifying bar. Instead, the catplot method uses the count plot to display frequencies. All of the other visuals we have looked at have been aggregating a numerical variable across a categorical variable. This plot simply counts the number of occurrences of the categorical variables specified in the x or y and hue parameters. It may be a little odd, but the catplot count plot is just a typical bar graph. Try not to get the bar catplot and the count catplot mixed up.
7. Time to practice!
Let's take a look at a few examples.