Conditional Plots

So far, we've mostly worked with plots that are quick to analyze and make sense of. Line charts, scatter plots, and bar plots allow us to convey a few nuggets of insights to the reader. We've also explored how we can combine those plots in interesting ways to convey deeper insights and continue to extend the storytelling power of data visualization. In this mission, we'll explore how to quickly create multiple plots that are subsetted using one or more conditions.

We'll be working with the Seaborn visualization library, which is built on top of matplotlib. Seaborn has good support for more complex plots, attractive default styles, and integrates well with the pandas library.

As we learn Seaborn, we'll be working with a data set of the passengers from the Titanic. The Titanic shipwreck is the most famous shipwreck in history and led to the creation of better safety regulations for ships. One substantial safety issue was that there were not enough lifeboats for every passenger on board, which meant that some passengers were prioritized over others to use the lifeboats.

The data set was compiled by Kaggle for their introductory data science competition, called Titanic: Machine Learning from Disaster. The goal of the competition is to build machine learning models that can predict if a passenger survives from their attributes. While this mission doesn't explicitly cover machine learning, you can learn about the fundamentals of machine learning in our Machine Learning Fundamentals course and learn more about Kaggle in our Kaggle Fundamentals course.


  • Learn about the Seaborn data visualization library.
  • Learn how Seaborn can make your plots stand out.

Mission Outline

1. Introduction to Seaborn
2. Introduction to the Data Set
3. Creating Histograms In Seaborn
4. Generating A Kernel Density Plot
5. Modifying The Appearance Of The Plots
6. Conditional Distributions Using A Single Condition
7. Creating Conditional Plots Using Two Conditions
8. Creating Conditional Plots Using Three Conditions
9. Adding A Legend
10. Next Steps
11. Takeaways


Course Info:


The median completion time for this course is 6.5 hours. View Details

This course is requires a basic subscription. This course includes four missions and one guided project.  It is the fifth course in the Data Analyst in Python path and the Data Scientist in Python path.


Take a Look Inside

(function(d) { d.addEventListener("DOMContentLoaded", function() { var pathname = d.location.pathname.replace(/^[/]|[/]$/g, "").replace("/", "-"); var tags = d.getElementsByTagName("iframe"); var type = pathname.startsWith("course") ? "?course=" : pathname.startsWith("path") ? "?path=" : null; if (type) { var i; for (i = 0; i < tags.length; i++) { if (tags[i].src.indexOf("signup#iframe") !== -1) { tags[i].src = tags[i].src.replace("#iframe", "") + type + pathname + "#iframe"; } } } }, false); })(document);