MulaiMulai sekarang secara gratis

Visualizing three numeric variables

There are also some "flat" alternatives to 3D plots that provide easier interpretation, though they require a little thinking about to make. A good approach is plotting the two numeric explanatory variables on the x- and y-axis of a scatter plot, and coloring the points according to the response variable.

taiwan_real_estate is available.

Latihan ini adalah bagian dari kursus

Intermediate Regression with statsmodels in Python

Lihat Kursus

Petunjuk latihan

  • Calculate the square-root of the distance to the nearest MRT stop as sqrt_dist_to_mrt_m.
  • With the taiwan_real_estate dataset, draw a scatter plot of sqrt_dist_to_mrt_m versus the number of nearby convenience stores, colored by house price.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Transform dist_to_mrt_m to sqrt_dist_to_mrt_m
taiwan_real_estate["sqrt_dist_to_mrt_m"] = ____

# Draw a scatter plot of sqrt_dist_to_mrt_m vs. n_convenience colored by price_twd_msq
____

# Show the plot
plt.show()
Edit dan Jalankan Kode