Plotten
Verfasst: Mittwoch 22. Januar 2020, 22:07
Hey, könnt ihr mir eine Vorlage geben, wie ich (x/y) Werte (als Punkte) auf eine doppellogarithmische Skala darstellen und einen linearen Fit durchziehen kann? Danke
Seit 2002 Diskussionen rund um die Programmiersprache Python
https://www.python-forum.de/
Code: Alles auswählen
fig, ax = plt.subplots()
ax.set_yscale('log')
ax.set_xscale('log')
plt.grid(True, which='both')
plt.scatter(x_werte, y_werte)
plt.show()
Code: Alles auswählen
from scipy.stats import linregress
lin_regression = linregress(x_werte, y_werte)
regression_werte = [lin_regression.slope*x + lin_regression.intercept for x in x_werte]
plt.plot(x_werte, regression_werte, color='red')