เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

หลายกราฟในพื้นที่เดียว

ในแบบฝึกหัดสุดท้ายนี้ เราจะสร้างกราฟเปรียบเทียบราคาเช่าตลาดที่เป็นธรรม สำหรับอพาร์ตเมนต์แบบ 1 ห้องนอนและ 2 ห้องนอน

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

การสร้างภาพข้อมูลระดับกลางด้วย Seaborn

ดูคอร์ส

คำแนะนำการฝึกหัด

  • สร้าง axes object สองตัว คือ ax0 และ ax1
  • พล็อต fmr_1 บน ax0 และ fmr_2 บน ax1
  • แสดงกราฟทั้งสองแบบเคียงข้างกัน

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# 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()
แก้ไขและรันโค้ด