Get startedGet started for free

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.

This exercise is part of the course

Intermediate Regression with statsmodels in Python

View Course

Exercise instructions

  • 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.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# 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 and Run Code