Answers for "np.polyfit plot"

0

np.polyfit plot

import numpy as np
from matplotlib import pyplot as plt
N = 10
xs = np.random.random(N)
ys = np.random.random(N)
trend = np.polyfit(xs,ys,1)
plt.plot(xs,ys,'o')
trendpoly = np.poly1d(trend) 
plt.plot(xs,trendpoly(xs))
Posted by: Guest on February-15-2022

Python Answers by Framework

Browse Popular Code Answers by Language