20
Wie könnte ich Trendlinien zu einem Punktdiagramm hinzufügen, das mit matplotlib.scatter gezeichnet wurde?Wie Trendlinie in Python Matplotlib Punkt (Scatter) Graphen hinzufügen?
Wie könnte ich Trendlinien zu einem Punktdiagramm hinzufügen, das mit matplotlib.scatter gezeichnet wurde?Wie Trendlinie in Python Matplotlib Punkt (Scatter) Graphen hinzufügen?
wie erläutert here
Mit Hilfe von numpy kann man beispielsweise eine lineare Anpassung berechnen.
# plot the data itself
pylab.plot(x,y,'o')
# calc the trendline
z = numpy.polyfit(x, y, 1)
p = numpy.poly1d(z)
pylab.plot(x,p(x),"r--")
# the line equation:
print "y=%.6fx+(%.6f)"%(z[0],z[1])
[diese] (http://stackoverflow.com/questions/7171356/python-calculating-trendlines-with-errors?rq=1) Frage zeigt, wie eine Trendlinie zu berechnen. Dann plotten Sie es. – aquavitae