Aan de slagGa gratis aan de slag

Multiple plots

For the final exercise we will plot a comparison of the fair market rents for 1-bedroom and 2-bedroom apartments.

Deze oefening maakt deel uit van de cursus

Intermediate Data Visualization with Seaborn

Cursus bekijken

Oefeninstructies

  • Create two axes objects, ax0 and ax1.
  • Plot fmr_1 on ax0 and fmr_2 on ax1.
  • Display the plots side by side.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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()
Code bewerken en uitvoeren