Visualizing Data Relationships with Seaborn Pair Plots

Visualize relationships between variables clearly with Seaborn pair plots.

Create insightful data visualizations quickly with Seaborn pair plots, an efficient tool for analyzing relationships among multiple variables. Identify clear patterns and correlations, such as the inverse relationship between engine size and fuel efficiency or the direct correlation between horsepower and vehicle price.

Key Insights

  • Seaborn pair plots rapidly generate comprehensive visualizations, displaying multiple variable relationships simultaneously through a concise, simple code syntax.
  • Examining the pair plots revealed a strong inverse correlation between engine size and fuel efficiency, indicating that larger engines typically result in lower fuel efficiency.
  • Pair plots highlighted a significant positive correlation between horsepower and price, showing horsepower as a strong predictor of vehicle pricing.

Note: These materials offer prospective students a preview of how our classes are structured. Students enrolled in this course will receive access to the full set of materials, including video lectures, project-based assignments, and instructor feedback.

Making a Seaborn pair plot is ridiculously easy. I mean, you know, assuming you already know how to do it. It's a very short amount of code.

So, you know, maybe not easy is not the right word. It's simple. SNS, which is typically what we name our, what we import Seaborn as.

Which by the way, doesn't stand for anything. Nobody knows why we started doing it as SNS. It's lost to the mist of time.

Seaborn people right now, we don't know. We say, make a pair plot from our car sales. And it will take a look just like we were able to say, give me a correlation matrix.

It can do the correlation matrix and make a plot of plots. Then we say, hey, pi plot, show that. And it will fail to auto, there it is.

Data Analytics Certificate: Live & Hands-on, In NYC or Online, 0% Financing, 1-on-1 Mentoring, Free Retake, Job Prep. Named a Top Bootcamp by Forbes, Fortune, & Time Out. Noble Desktop. Learn More.

And it'll take a moment. It takes a second to make a pair plot. It's 25 graphs.

There they are. Let's take a look at these. Ooh, they're slightly cut off.

Ah, we need to make this a little bit bigger at the top. No, there we go. It was just, it was just scrolled.

We could, you know, re change the size of this, but it seems like it's totally fine. Don't, don't panic everybody. Stop panicking.

Everything looks great. Okay, so what is this? Again, when you are looking at the relationship and a relationship of sales in thousands to sales in thousands, right? Sales in thousands at the top, sales in thousands down here. Yeah, I'm going to zoom out.

Yeah, sales in thousands to sales in thousands. All down this line, we are comparing the thing to itself. So rather than show 1.0, it's showing us a histogram.

What we looked at earlier, when you're looking at distributions. So this is the distribution of sales in thousands. A lot of things, you know, selling at this low price point and just like one thing selling way over here.

And, and the same for fuel efficiency. Here's the distribution of fuel efficiency. You can see these are vague bell curves.

There's not a lot of data, so they're not smooth, but they are normal distributions, price in thousands, engine size and so on. But the interesting thing here is each one's relationship to other things. A lot of them are blobs.

Sales in thousands doesn't really seem to correlate with anything. It's again, we can really see from this graph why our domain knowledge was wrong. The data shows like there's no relationships to anything here.

Now, other ones have a stronger relationship. The most obviously strong one here is horsepower to price in thousands. That seems like a really good predictor overall.

This horsepower to price in thousands. Now, there are other ones that are strong predictors, some of them in the other direction, right? If we look at fuel efficiency and engine size, engine size, fuel efficiency, right? Engine size here on the left, sorry, fuel efficiency here on the left, engine size here on the bottom. They're negatively correlated.

They're going down into the right, right? So there's a strong correlation there. It's just in the opposite direction. The higher the engine size, the lower the fuel efficiency.

But let's take a look at price in thousands. That's what we're most interested in. Again, no real relationship here.

Some relationship to fuel efficiency. There's a down and to the right relationship here. The higher the fuel efficiency, the lower the price in thousands.

And then horsepower and engine size have fairly strong, particularly horsepower relationships here. So this is a great way to really visualize this, not just as numbers, but as different data points and seeing their relationship. Pair plots, one of the best.

Colin Jaffe

Colin Jaffe is a programmer, writer, and teacher with a passion for creative code, customizable computing environments, and simple puns. He loves teaching code, from the fundamentals of algorithmic thinking to the business logic and user flow of application building—he particularly enjoys teaching JavaScript, Python, API design, and front-end frameworks.

Colin has taught code to a diverse group of students since learning to code himself, including young men of color at All-Star Code, elementary school kids at The Coding Space, and marginalized groups at Pursuit. He also works as an instructor for Noble Desktop, where he teaches classes in the Full-Stack Web Development Certificate and the Data Science & AI Certificate.

Colin lives in Brooklyn with his wife, two kids, and many intricate board games.

More articles by Colin Jaffe

How to Learn Machine Learning

Master machine learning with hands-on training. Use Python to make, modify, and test your own machine learning models.

Yelp Facebook LinkedIn YouTube Twitter Instagram