From cf1565f7d38155fd6287330285ba988254cce5f0 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Mon, 31 Jul 2023 11:48:57 +0000 Subject: [PATCH] use symbol for length 1 data in shift/scale; fixes #112 --- src/gui_qt/data/shift_graphs.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/gui_qt/data/shift_graphs.py b/src/gui_qt/data/shift_graphs.py index 61dc918..f436989 100644 --- a/src/gui_qt/data/shift_graphs.py +++ b/src/gui_qt/data/shift_graphs.py @@ -1,7 +1,7 @@ import numpy as np from itertools import cycle -from pyqtgraph import mkColor, mkPen +from pyqtgraph import mkColor, mkPen, mkBrush from nmreval.lib.colors import Tab10 @@ -42,11 +42,17 @@ class QShift(QtWidgets.QDialog, Ui_shift_dialog): def add_item(self, idx, name, x, y): color = mkColor(next(self._colors).rgb()) - if np.iscomplexobj(y): - pl = [PlotItem(x=x, y=y.real, name=name, pen=mkPen(color=color)), - PlotItem(x=x, y=y.imag, name=name, pen=mkPen(color=color))] + + if len(y) == 1: + sym_kwds = {'symbol': 'o', 'symbolBrush': mkBrush(color=color), 'symbolPen': mkPen(color=color)} else: - pl = [PlotItem(x=x, y=y, name=name, pen=mkPen(color=color))] + sym_kwds = {'symbol': None, 'symbolBrush': mkBrush(color=color), 'symbolPen': mkPen(color=color)} + + if np.iscomplexobj(y): + pl = [PlotItem(x=x, y=y.real, name=name, pen=mkPen(color=color), **sym_kwds), + PlotItem(x=x, y=y.imag, name=name, pen=mkPen(color=color), **sym_kwds)] + else: + pl = [PlotItem(x=x, y=y, name=name, pen=mkPen(color=color), **sym_kwds)] self.data[idx] = (pl, x, y)