MulaiMulai sekarang secara gratis

Beeswarms

Build a beeswarm plot using sns.swarmplot() that looks at the Ozone levels for all the cities in the pollution data for the month of March. To make the beeswarm a bit more legible, decrease the point size to avoid the overcrowding caused by the many points drawn on the screen. Last, since you've done some manipulation of the data to make this plot, provide a title to help the reader orient with what they are viewing.

Latihan ini adalah bagian dari kursus

Improving Your Data Visualizations in Python

Lihat Kursus

Petunjuk latihan

  • Subset the pollution data to include just the observations in March.
  • Plot the O3 levels as the continuous value in the swarmplot().
  • Decrease the point size to 3 to avoid crowding of the points.
  • Title the plot 'March Ozone levels by city'.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Filter data to just March
pollution_mar = pollution[pollution.month == ____]

# Plot beeswarm with x as O3
sns.swarmplot(y = "city",
              x = '____', 
              data = pollution_mar, 
              # Decrease the size of the points to avoid crowding 
              size = ____)

# Give a descriptive title
plt.____('____')
plt.show()
Edit dan Jalankan Kode