So I'm trying to add a line of best fit to a graph using the plt.axhline()
feature. The code I have currently is below which is working currently but doesn't include the axhline code,
df = pd.DataFrame(pd.read_csv('test5.csv', sep=','))
x = df["IE ratio"]
y = df["109"]
x1 = df["IE ratio"].mean()
plt.axvline(x1, 0, 1, c= 'k')
plt.scatter(x, y, s = 10)
plt.ylabel('Appearance of mutation')
plt.xlabel('IE spectrum')
plt.show()
I've tried to bring in the plt.axhline()
feature but can't work out what I need to put in the bracket to get my desired output.
Here's the plot I get with a red line I've drawn on to show what I'm hoping to produce.
Thanks in advance for any advice or help!