0Pricing
Data Science Academy · Lesson

Facets, Hue, and Style

Splitting plots by category.

Facets, Hue, and Style is a free Data Science Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Data Science Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

One Chart, Many Slices

Sometimes one plot hides too much. Faceting splits your data into a grid of small charts, one per category, so each group gets its own view.

Encode Groups With hue

The lightest way to compare groups is color. hue maps a category to colors inside a single plot, no extra panels needed.

sns.scatterplot(data=df, x="x", y="y", hue="group")

Split Into Columns

To break groups into separate panels, use a figure-level plot with col. Each category becomes its own side-by-side chart.

sns.relplot(data=df, x="x", y="y", col="group")

Split Into Rows Too

Pair col with row to build a full grid. One variable spreads across columns while another stacks down the rows.

sns.relplot(data=df, x="x", y="y", col="region", row="year")

Figure-Level vs Axes-Level

Faceting needs figure-level functions like relplot, displot, and catplot. The plain plots such as scatterplot live inside a single panel.

Wrap Long Facet Rows

Many categories make an endless row. col_wrap tells seaborn how many panels to allow before starting a new line.

sns.relplot(data=df, x="x", y="y", col="city", col_wrap=3)

Style Encodes Without Color

Beyond color, style maps a category to marker shapes or dashed lines, helping when prints are black and white.

sns.lineplot(data=df, x="x", y="y", style="device")

Pick a Color Palette

Swap the colors with palette. Choose a vivid set for distinct groups or a gradient for values that go from low to high.

sns.scatterplot(data=df, x="x", y="y", hue="group", palette="viridis")

Set the Overall Look

One call restyles every chart at once. set_theme controls the background, gridlines, and default palette for the session.

sns.set_theme(style="darkgrid", palette="muted")

Combine hue and Facets

You can layer them: color within each panel and split panels by another field. Just avoid encoding so much that the message gets lost.

sns.relplot(data=df, x="x", y="y", hue="sex", col="day")

Less Is Often More

Every extra hue, style, and facet adds load for the reader. Aim for the simplest view that still answers the question.

Quick Check

You want each category drawn in its own separate panel.

Recap: Encode, Facet, Style

You now layer information with hue and style, split groups using facets, and theme it all cleanly, while keeping the chart easy to read. 🎨

Frequently asked questions

Is the “Facets, Hue, and Style” lesson free?

Yes — the full text of “Facets, Hue, and Style” is free to read here on the web, and the Data Science Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Data Science Academy course, upgrade to CoddyKit PRO.

What will I learn in “Facets, Hue, and Style”?

Splitting plots by category. You practise Data Science Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Data Science Academy?

No prior experience is required. Data Science Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Facets, Hue, and Style” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Data Science Academy lesson?

Yes. Every Data Science Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Why seaborn Over Raw matplotlib
  2. Distributions: hist, kde, box
  3. Relationships: scatter and line
  4. Facets, Hue, and Style
← Back to Data Science Academy