始める無料で始める

lmplot の使い方

lmplot は、FacetGrid オブジェクト上に回帰直線付きの散布図を描画するために使用します。 API は catplot に似ていますが、lmplot はデフォルトで回帰直線を描画する点が異なります。

最初の演習では、学部生の人数(UG)とペル・グラント受給率(PCTPELL)の関係を見ていきましょう。

2 つ目の lmplot 演習では、平均 SAT スコアと学費の関係を、学位の種類および公立・非営利校の区分ごとに比較します。

この演習はコースの一部です

Seaborn による中級データ可視化

コースを見る

実践的なインタラクティブ演習

このサンプルコードを完成させて、この演習に挑戦してみましょう。

# Create a FacetGrid varying by column and columns ordered with the degree_order variable
g = sns.FacetGrid(df, ___="Degree_Type", ____order=degree_ord)

# Map a scatter plot of Undergrad Population compared to PCTPELL
g.map(plt.___, 'UG', 'PCTPELL')

plt.show()
plt.clf()
コードを編集して実行