0Pricing
Data Science Academy · レッスン

Facet、Hue、Style

カテゴリごとにグラフを分ける

「Facet、Hue、Style」はCoddyKit上の無料Data Science Academyレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはData Science Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Data Science Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

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. 🎨

よくある質問

「Facet、Hue、Style」レッスンは無料ですか?

はい。「Facet、Hue、Style」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Data Science Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Data Science Academyコースには全4レッスンが含まれています。

「Facet、Hue、Style」で何を学びますか?

カテゴリごとにグラフを分ける ブラウザで直接実行するハンズオンコードでData Science Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Data Science Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのData Science Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。

「Facet、Hue、Style」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このData Science Academyレッスンでコードを書いて実行できますか?

はい。すべてのData Science Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. 生のmatplotlibよりseabornを使う理由
  2. 分布:hist、kde、box
  3. 関係性:scatterとline
  4. Facet、Hue、Style
← Data Science Academyに戻る