forked from IPKM/nmreval
use symbol for length 1 data in shift/scale; fixes #112
This commit is contained in:
parent
63f4f82228
commit
cf1565f7d3
@ -1,7 +1,7 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from itertools import cycle
|
from itertools import cycle
|
||||||
|
|
||||||
from pyqtgraph import mkColor, mkPen
|
from pyqtgraph import mkColor, mkPen, mkBrush
|
||||||
|
|
||||||
from nmreval.lib.colors import Tab10
|
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):
|
def add_item(self, idx, name, x, y):
|
||||||
color = mkColor(next(self._colors).rgb())
|
color = mkColor(next(self._colors).rgb())
|
||||||
if np.iscomplexobj(y):
|
|
||||||
pl = [PlotItem(x=x, y=y.real, name=name, pen=mkPen(color=color)),
|
if len(y) == 1:
|
||||||
PlotItem(x=x, y=y.imag, name=name, pen=mkPen(color=color))]
|
sym_kwds = {'symbol': 'o', 'symbolBrush': mkBrush(color=color), 'symbolPen': mkPen(color=color)}
|
||||||
else:
|
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)
|
self.data[idx] = (pl, x, y)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user