関係性:scatterとline
2つの変数を一緒に描画する
「関係性:scatterとline」はCoddyKit上の無料Data Science Academyレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはData Science Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Data Science Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
From One Column to Two
Distributions look at a single column. Now you ask how two columns move together, which is the heart of finding a relationship.
The Scatter Plot
A scatter plot places one dot per row, using two columns as x and y. The cloud of dots reveals how the variables connect.
sns.scatterplot(data=df, x="hours", y="score")Read the Pattern
Dots sloping up mean a positive link, sloping down means negative, and a shapeless blob means little correlation between them.
Add a Third Dimension With hue
Color the dots by a category using hue. Now one plot shows the relationship split across each group at the same time.
sns.scatterplot(data=df, x="hours", y="score", hue="grade")Size Encodes a Fourth Variable
Map a column to dot size to pack in even more. Bigger dots can mean larger sales, population, or any numeric measure.
sns.scatterplot(data=df, x="hours", y="score", size="effort")The Line Plot
When x is ordered, like dates or steps, a line plot connects the points to show how a value changes over that sequence.
sns.lineplot(data=df, x="month", y="revenue")Scatter vs Line
Use a scatter for unordered pairs and a line when the x axis flows in order. Picking the right one keeps the trend honest.
Lines Aggregate Automatically
If several rows share an x value, seaborn averages their y and draws a shaded confidence band around the line for you.
Multiple Lines With hue
Add hue to a line plot and each category becomes its own colored line. Comparing trends across groups takes just one extra word.
sns.lineplot(data=df, x="month", y="revenue", hue="region")Add a Trend Line With regplot
Want the best-fit line drawn through a scatter? regplot overlays a regression line so the direction is impossible to miss.
sns.regplot(data=df, x="hours", y="score")Correlation Is Not Causation
A clear upward cloud shows two things rise together, not that one causes the other. Always pair a plot with judgment.
Quick Check
Your x axis is ordered by month and you want to show change over time.
Recap: Show How Two Things Connect
You can now reveal relationships with scatter for pairs and lines for ordered trends, and add hue or size to layer in more. 🔗
よくある質問
「関係性:scatterとline」レッスンは無料ですか?
はい。「関係性:scatterとline」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Data Science Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Data Science Academyコースには全4レッスンが含まれています。
「関係性:scatterとline」で何を学びますか?
2つの変数を一緒に描画する ブラウザで直接実行するハンズオンコードでData Science Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Data Science Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのData Science Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。
「関係性:scatterとline」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このData Science Academyレッスンでコードを書いて実行できますか?
はい。すべてのData Science Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- 生のmatplotlibよりseabornを使う理由
- 分布:hist、kde、box
- 関係性:scatterとline
- Facet、Hue、Style