[plotter] make it possible to fit even if yerr_kind is None
This commit is contained in:
+2
-2
@@ -1130,7 +1130,7 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
Add an overlay : fit a curve, linear or powerlaw
|
||||
"""
|
||||
if kind == "linear":
|
||||
if yerr is None:
|
||||
if yerr is None or np.sum(np.abs(yerr)) == 0:
|
||||
(a, b, rho, _map_rule, stderr) = linregress(x, y)
|
||||
self._log(
|
||||
"Linear fit y = {} x + {} with R^2 = {} and error is {}".format(
|
||||
@@ -1153,7 +1153,7 @@ class Plotter(Aggregator, BaseProcessor):
|
||||
label = r"Linear fit with slope ${:.3g}$".format(a)
|
||||
plt.plot(x, a * x + b, label=label, **kwargs)
|
||||
elif kind == "power_law":
|
||||
if yerr is None:
|
||||
if yerr is None or np.sum(np.abs(yerr)) == 0:
|
||||
(a, b, rho, _map_rule, stderr) = linregress(np.log10(x), np.log10(y))
|
||||
self._log(
|
||||
"Power law fit y = x^({}) * {} with R^2 = {} and error is {}".format(
|
||||
|
||||
Reference in New Issue
Block a user