Mehrere Plots
In der letzten Übung vergleichen wir die Fair-Market-Mieten für 1‑Zimmer- und 2‑Zimmer‑Wohnungen in einem Plot.
Diese Übung ist Teil des Kurses
Fortgeschrittene Datenvisualisierung mit Seaborn
Anleitung zur Übung
- Erstelle zwei Achsenobjekte,
ax0undax1. - Plotte
fmr_1aufax0undfmr_2aufax1. - Zeige die Plots nebeneinander an.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# 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()