MulaiMulai sekarang secara gratis

Beberapa plot

Untuk latihan terakhir, kita akan membuat perbandingan fair market rent untuk apartemen 1-kamar tidur dan 2-kamar tidur.

Latihan ini adalah bagian dari kursus

Visualisasi Data Lanjutan dengan Seaborn

Lihat Kursus

Petunjuk latihan

  • Buat dua objek axes, ax0 dan ax1.
  • Plot fmr_1 pada ax0 dan fmr_2 pada ax1.
  • Tampilkan plot berdampingan.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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()
Edit dan Jalankan Kode