diff --git a/Orange/widgets/data/owpaintdata.py b/Orange/widgets/data/owpaintdata.py index 42a69ff82d3..1dd030e1808 100644 --- a/Orange/widgets/data/owpaintdata.py +++ b/Orange/widgets/data/owpaintdata.py @@ -1226,18 +1226,16 @@ def pen(color): self.plot.removeItem(self._scatter_item) self._scatter_item = None - nclasses = len(self.class_model) - pens = [pen(self.colors[i]) for i in range(nclasses)] - x = self.__buffer[:, 0].copy() if self.hasAttr2: y = self.__buffer[:, 1].copy() else: y = np.zeros(self.__buffer.shape[0]) - pen = [pens[ci] for ci in self.__buffer[:, 2].astype(int)] + colors = self.colors[self.__buffer[:, 2]] + pens = [pen(c) for c in colors] self._scatter_item = pg.ScatterPlotItem( - x, y, symbol="+", pen=pen + x, y, symbol="+", pen=pens ) self.plot.addItem(self._scatter_item) diff --git a/Orange/widgets/data/tests/test_owpaintdata.py b/Orange/widgets/data/tests/test_owpaintdata.py index 6ff2cefa2de..34810433720 100644 --- a/Orange/widgets/data/tests/test_owpaintdata.py +++ b/Orange/widgets/data/tests/test_owpaintdata.py @@ -7,7 +7,7 @@ from Orange.data import Table from Orange.widgets.data import owpaintdata from Orange.widgets.data.owpaintdata import OWPaintData -from Orange.widgets.tests.base import WidgetTest +from Orange.widgets.tests.base import WidgetTest, datasets class TestOWPaintData(WidgetTest): @@ -25,6 +25,10 @@ def test_empty_data(self): self.send_signal("Data", data) self.send_signal("Data", Table(data.domain)) + def test_nan_data(self): + data = datasets.missing_data_2() + self.send_signal("Data", data) + def test_output_shares_internal_buffer(self): data = Table("iris")[::5] self.send_signal("Data", data)