Meerdere plots
In de laatste oefening plotten we een vergelijking van de fair market rents voor appartementen met 1 en 2 slaapkamers.
Deze oefening maakt deel uit van de cursus
Gevorderde datavisualisatie met Seaborn
Oefeninstructies
- Maak twee axes-objecten aan:
ax0enax1. - Plot
fmr_1opax0enfmr_2opax1. - Toon de plots naast elkaar.
Interactieve oefening met praktijkervaring
Probeer deze oefening door deze voorbeeldcode aan 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()