プロットのカスタマイズ(応用)
matplotlib の API では、軸のラベル付け、タイトルの追加、表示範囲の設定など、よく使われるカスタマイズが幅広くサポートされています。引き続き、カスタマイズの演習に取り組みましょう。
この演習はコースの一部です
Seaborn による中級データ可視化
演習の手順
fmr_1列のヒストグラムをhistplotで作成しましょう。- x 軸のラベルを "1 Bedroom Fair Market Rent" に変更しましょう。
- x 軸の表示範囲を 100 から 1500 の間に設定しましょう。
- プロットに
"US Rent"というわかりやすいタイトルを追加しましょう。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Create a figure and axes
fig, ____ = plt.subplots()
# Plot the distribution of 1 bedroom rents
sns.____(df['fmr_1'], ax=____)
# Modify the properties of the plot
ax.set(xlabel="1 Bedroom Fair Market Rent",
xlim=(____,____),
____="US Rent")
# Display the plot
plt.show()