多个图形
在最后一个练习中,我们将对比绘制 1 卧室与 2 卧室公寓的公平市场租金。
本练习是课程的一部分
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()