多個圖表
在最後一題練習中,我們要比較 1 房與 2 房公寓的公平市價租金(fair market rents)。
本練習屬於課程
Seaborn 資料視覺化中級
練習說明
- 建立兩個座標軸物件
ax0與ax1。 - 在
ax0繪製fmr_1,在ax1繪製fmr_2。 - 將兩個圖表並排顯示。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Create a plot with 1 row and 2 columns that share the y axis label
fig, (ax0, ax1) = plt.subplots(nrows=____, ncols=____, sharey=____)
# Plot the distribution of 1 bedroom apartments on ax0
sns.histplot(df['____'], ax=____)
____.set(xlabel="1 Bedroom Fair Market Rent", xlim=(100,1500))
# Plot the distribution of 2 bedroom apartments on ax1
sns.histplot(df['____'], ax=____)
____.set(xlabel="2 Bedroom Fair Market Rent", xlim=(100,1500))
# Display the plot
plt.show()