Skip to content

Commit

Permalink
Radviz: Enable projection for less than two selected variables
Browse files Browse the repository at this point in the history
  • Loading branch information
VesnaT committed Dec 8, 2018
1 parent 97dee02 commit bfe54d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
7 changes: 0 additions & 7 deletions Orange/widgets/visualize/owradviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ class OWRadviz(OWAnchorProjectionWidget):
graph = SettingProvider(OWRadvizGraph)

class Warning(OWAnchorProjectionWidget.Warning):
no_features = widget.Msg("Radviz requires at least two features.")
invalid_embedding = widget.Msg("No projection for selected features")
removed_vars = widget.Msg("Categorical variables with more than"
" two values are not shown.")
Expand Down Expand Up @@ -331,12 +330,6 @@ def __vizrank_set_attrs(self, attrs):
def __model_selected_changed(self):
self.selected_vars = [(var.name, vartype(var)) for var
in self.model_selected]

self.Warning.no_features.clear()
if len(self.model_selected) < 2:
self.Warning.no_features()
return

self.init_projection()
self.setup_plot()
self.commit()
Expand Down
13 changes: 13 additions & 0 deletions Orange/widgets/visualize/tests/test_owradviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,16 @@ def test_discrete_attributes(self):
self.assertTrue(self.widget.Warning.removed_vars.is_shown())
self.send_signal(self.widget.Inputs.data, None)
self.assertFalse(self.widget.Warning.removed_vars.is_shown())

def test_saved_selected_vars(self):
self.send_signal(self.widget.Inputs.data, self.data)

self.widget.model_selected[:] = self.data.domain[:1]
self.widget.variables_selection.removed.emit()
self.send_signal(self.widget.Inputs.data, self.data)
self.assertEqual(len(self.widget.model_selected[:]), 1)

self.widget.model_selected[:] = self.data.domain[:0]
self.widget.variables_selection.removed.emit()
self.send_signal(self.widget.Inputs.data, self.data)
self.assertEqual(len(self.widget.model_selected[:]), 4)

0 comments on commit bfe54d5

Please sign in to comment.