VisualizeExtra· 30 min read

Statistical Charts with Seaborn

Seaborn sits on top of Matplotlib and makes beautiful statistical charts — straight from a DataFrame — in one line.

What you will learn

  • Make a chart directly from a DataFrame
  • Use a histogram and a scatter plot
  • See why Seaborn is great for exploring

Prettier charts, less code

Seaborn is built on top of Matplotlib. It produces good-looking statistical charts with much less code, and — best of all — it works directly from a DataFrame by naming columns. It is the fastest way to explore data visually. By convention we import it as sns.

We will use this little table:

A small house dataset for Seaborn
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd

df = pd.DataFrame({
    'size':  [50, 60, 80, 100, 120],   # house size
    'price': [40, 55, 70, 95, 110]     # house price
})

Note: Output: (No output — just the table. Five houses, with a size and a price. As size goes up, price seems to go up too. Let us see it.)

A histogram — the shape of one column

A histogram shows how the values of one column are spread out — where most of them sit. Seaborn draws it from the column name.

A histogram of the price column
sns.histplot(data=df, x='price')
plt.title('Distribution of Prices')
plt.show()

Note: Output: (A chart with bars showing how many houses fall in each price band. The prices spread fairly evenly from 40 to 110.) A histogram answers “what do typical values look like, and are there outliers?” at a glance.

A scatter plot — two columns together

A scatter plot shows the relationship between two number columns — one dot per row. It is the best way to see if two things move together.

A scatter plot of price against size
sns.scatterplot(data=df, x='size', y='price')
plt.title('Price vs Size')
plt.show()

Note: Output: (Five dots climbing from lower-left to upper-right.) The dots rise together: bigger houses cost more. That upward pattern is a positive relationship — the idea behind correlation, coming up in the Stats unit.

Seaborn functionShowsGood for
sns.histplotSpread of one columnSeeing typical values
sns.scatterplotTwo columns vs each otherSpotting relationships
sns.barplotAverage per categoryComparing groups
sns.boxplotSpread per categoryComparing distributions

Tip: Seaborn and Matplotlib work together: draw with Seaborn for looks, then use plt functions like plt.title() to fine-tune. You are not choosing one — you use both.

Q. Which Seaborn chart best shows whether two number columns move together?

Answer: A scatter plot puts one dot per row using two columns as x and y, so an upward or downward pattern reveals their relationship.

✍️ Practice

  1. Use sns.histplot to show the spread of one numeric column in a DataFrame.
  2. Use sns.scatterplot to plot two numeric columns and describe the pattern you see.

🏠 Homework

  1. On a real dataset, make a histogram of one column and a scatter plot of two columns. Write one sentence about what each chart tells you.
Want to learn this with a mentor?

CodingClave runs guided, project-based training (28-day, 45-day & 6-month batches).

Explore Training →