Skip to content

Commit 67fa9df

Browse files
authored
Merge pull request #2752 from JakaKokosar/PaintData
Add option to adjust symbol size
2 parents 5557abc + 2168c9a commit 67fa9df

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

Orange/widgets/data/owpaintdata.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,8 @@ class Outputs:
759759

760760
brushRadius = Setting(75)
761761
density = Setting(7)
762+
symbol_size = Setting(10)
763+
762764
#: current data array (shape=(N, 3)) as presented on the output
763765
data = Setting(None, schema_only=True)
764766
labels = Setting(["C1", "C2"], schema_only=True)
@@ -922,6 +924,14 @@ def _init_ui(self):
922924
)
923925

924926
form.addRow("Intensity:", slider)
927+
928+
slider = gui.hSlider(
929+
indBox, self, "symbol_size", None, minValue=1, maxValue=100,
930+
createLabel=False, callback=self.set_symbol_size
931+
)
932+
933+
form.addRow("Symbol:", slider)
934+
925935
self.btResetToInput = gui.button(
926936
tBox, self, "Reset to Input Data", self.reset_to_input)
927937
self.btResetToInput.setDisabled(True)
@@ -964,6 +974,10 @@ def _init_ui(self):
964974

965975
self.set_dimensions()
966976

977+
def set_symbol_size(self):
978+
if self._scatter_item:
979+
self._scatter_item.setSize(self.symbol_size)
980+
967981
def set_dimensions(self):
968982
if self.hasAttr2:
969983
self.plot.setYRange(0, 1, padding=0.01)
@@ -1235,10 +1249,13 @@ def pen(color):
12351249

12361250
colors = self.colors[self.__buffer[:, 2]]
12371251
pens = [pen(c) for c in colors]
1252+
brushes = [QBrush(c) for c in colors]
1253+
12381254
self._scatter_item = pg.ScatterPlotItem(
1239-
x, y, symbol="+", pen=pens
1255+
x, y, symbol="+", brush=brushes, pen=pens
12401256
)
12411257
self.plot.addItem(self._scatter_item)
1258+
self.set_symbol_size()
12421259

12431260
def _attr_name_changed(self):
12441261
self.plot.getAxis("bottom").setLabel(self.attr1)

0 commit comments

Comments
 (0)