Skip to content

Commit cf515f9

Browse files
authored
Merge pull request #2541 from jerneju/scatterplot-plotutils
Move common things from Scatter Plot to SP Graph and Plot GUI
2 parents 0aa74d7 + a07bfb6 commit cf515f9

File tree

4 files changed

+210
-145
lines changed

4 files changed

+210
-145
lines changed

Orange/widgets/utils/annotated_data.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,21 @@ def create_annotated_table(data, selected_indices):
6767
table = data.transform(domain)
6868
table[:, name] = annotated
6969
return table
70+
71+
72+
def create_groups_table(data, selection):
73+
if data is None:
74+
return None
75+
names = [var.name for var in data.domain.variables + data.domain.metas]
76+
name = get_next_name(names, "Selection group")
77+
metas = data.domain.metas + (
78+
DiscreteVariable(
79+
name,
80+
["Unselected"] + ["G{}".format(i + 1)
81+
for i in range(np.max(selection))]),
82+
)
83+
domain = Domain(data.domain.attributes, data.domain.class_vars, metas)
84+
table = data.transform(domain)
85+
table.metas[:, len(data.domain.metas):] = \
86+
selection.reshape(len(data), 1)
87+
return table

0 commit comments

Comments
 (0)