From 1802b72cb1f5cf576728223d1a0880d4c25fb90d Mon Sep 17 00:00:00 2001 From: Craig Gidney Date: Mon, 29 Jul 2024 18:41:46 -0700 Subject: [PATCH] Show traditional error bars when only one data point is present --- glue/sample/src/sinter/_plotting.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/glue/sample/src/sinter/_plotting.py b/glue/sample/src/sinter/_plotting.py index 08837ff2..1755f7e2 100644 --- a/glue/sample/src/sinter/_plotting.py +++ b/glue/sample/src/sinter/_plotting.py @@ -537,8 +537,13 @@ def group_dict_func(item: 'sinter.TaskStats') -> _FrozenDict: for x, y, lbl in zip(xs_label, ys_label, vs_label): if lbl: ax.annotate(lbl, (x, y)) - if xs_low_high: + if len(xs_low_high) > 1: ax.fill_between(xs_low_high, ys_low, ys_high, color=color, alpha=0.2, zorder=-100) + elif len(xs_low_high) == 1: + l, = ys_low + h, = ys_high + m = (l + h) / 2 + ax.errorbar(xs_low_high, [m], yerr=([m - l], [h - m]), marker='', elinewidth=1, ecolor=color, capsize=5) if line_fits is not None and len(set(xs_best)) >= 2: x_scale, y_scale = line_fits