Question 1 of 30
In a data analysis project, you are tasked with visualizing the relationship between two variables: the number of hours studied and the corresponding scores achieved by students in an exam. You decide to use Matplotlib to create a scatter plot to represent this data. After plotting the points, you want to enhance the visualization by adding a trend line that represents the linear relationship between the two variables. Which of the following methods would you use to achieve this?
Use `numpy.polyfit()` to calculate the best-fit line and then plot it using `matplotlib.pyplot.plot()`
Directly plot the points using `matplotlib.pyplot.scatter()` and add a line using `matplotlib.pyplot.axhline()`
Utilize `matplotlib.pyplot.bar()` to create a bar chart of the scores instead of a scatter plot
Apply `matplotlib.pyplot.fill_between()` to shade the area under the scatter plot

Preparing for Microsoft 98-381 Introduction to Programming Using Python? Now land the interview.

73% of qualified candidates get rejected because of weak resumes. Build an ATS-optimized, recruiter-ready resume in under 5 minutes - free to start.

Build My Resume Free