You’ve performed Multiple Linear Regression, and you also have the predictions in y_predict. However, we don’t have insight into the data, yet. In this exercise, you’ll create a 2D scatterplot to see how the independent variables impact prices.

How do you create 2D graphs?

Graphs can be created using Matplotlib’s pyplot module. Here is the code with inline comments explaining how to plot using Matplotlib’s .scatter():

# Create a scatter plot plt.scatter(x, y, alpha=0.4) # Create x-axis label and y-axis label plt.xlabel("the x-axis label") plt.ylabel("the y-axis label") # Create a title plt.title("title!") # Show the plot plt.show()

We want to create a scatterplot like this:



Create a 2D scatter plot using y_test and y_predict.

The x-axis should represent actual rent prices and the y-axis should represent predicted rent prices.


Add appropriate x-axis labels and y-axis labels, as well as a title.


Show the plot using plt.show().

Sign up to start coding

Mini Info Outline Icon

Or sign up using:

Already have an account?