1. Customizing with matplotlib
Seaborn has several convenience functions for modifying components of your final Seaborn visualization. Since Seaborn is based on matplotlib, there is a wide variety of options for further modifying your Seaborn plots. This video will show you how to further configure your plots using the underlying matplotlib library.
2. Matplotlib Axes
As we have discussed in prior lessons, Seaborn does its best to make plots look good with minimal changes on your part. By using matplotlib's axes objects, you can customize almost any element of your plot. The most important concept is to add additional code to create the subplots using matplotlib's subplots functions and pass the resulting axes object to the Seaborn function. Seaborn will then plot the data on the given axes.
In this example, I have used the ax set function to customize the x-label to show that the tuition data is for the 2013-2014 school year.
3. Further Customizations
This example shows how much control you have once you start modifying the axes. In addition to setting an x-label, I have also changed the y-label and set a limit so that tuition ranges are only between 0 and $50,000. Finally, I added a title.
4. Combining Plots
This example illustrates how you can combine and customize multiple Seaborn plots. First, we create two axes and ensure that the y-axis is shared between the plots. Next, we plot a full histogram on ax0. Then, we use pandas' query function to only plot the data for the state of Minnesota. The other new concept is the use of the axvline to denote the maximum amount we can budget for tuition. In this case, $20,000. The final step is to turn on the legend and display it.
5. Combining Plots
This example shows how much control you can have when creating your own visualizations.
6. Let's practice!
Now that you understand the basics of customizing your Seaborn plots using matplotlib, we can try some exercises to get some real world experience.