Question: Use the dataframe created in the next code cell and complete tasks 1 - 6 to generate the following figure: 1 . Create a scatterplot,

Use the dataframe created in the next code cell and complete tasks 1-6 to generate the following figure:
1. Create a scatterplot, where the x-axis corresponds to the default index of the dataframe, and the y-axis represents the values from the column Y.
2. Calculate the mean of Y and show it as a solid horizontal line on the graph.
3. Calculate the standard deviation of Y and draw two dashed lines, each representing one standard deviation away from the mean.
4. Set x-axis and y-axis limits as [-1,11] and [-20,30] respectively.
5. Enhance plot clarity by removing ticks on the x-axis.
6. Set the legend in the bottom-right corner of the graph.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
temp={"X":{"0":1,"1":5,"2":2,"3":4,"4":4,"5":5,"6":6,"7":7,"8":8,"9":6},"Y":{"0":-2.0,"1":-6.0,"2":4.0,"3":2.0,"4":10.0,"5":-12.0,"6":3.0,"7":5.0,"8":27.0,"9":3.5}}
df=pd.DataFrame(temp)
solution here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!