Skip to content

Commit 7d3c11f

Browse files
committed
Scatter Plot - Fix Vizrank for hidden attributes
1 parent 9eb6490 commit 7d3c11f

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

Orange/widgets/visualize/owscatterplot.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from itertools import chain
21
from xml.sax.saxutils import escape
32

43
import numpy as np
@@ -87,9 +86,11 @@ def bar_length(self, score):
8786

8887
def score_heuristic(self):
8988
assert self.attr_color is not None
90-
master_domain = self.master.data.domain
91-
vars = [v for v in chain(master_domain.variables, master_domain.metas)
92-
if v is not self.attr_color and v.is_primitive()]
89+
vars = [
90+
v
91+
for v in self.master.xy_model # same attributes that are in xy combos
92+
if v is not self.attr_color and v.is_primitive()
93+
]
9394
domain = Domain(attributes=vars, class_vars=self.attr_color)
9495
data = self.master.data.transform(domain)
9596
relief = ReliefF if isinstance(domain.class_var, DiscreteVariable) \

Orange/widgets/visualize/tests/test_owscatterplot.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,20 @@ def test_vizrank_enabled_color_var_nans(self):
472472
self.assertEqual(self.widget.vizrank_button.toolTip(),
473473
"Color variable has no values")
474474

475+
def test_vizrank_hidden_attributes(self):
476+
"""
477+
Test hidden attributes not considered in Find Informative Projections
478+
"""
479+
new_domain = self.data.domain.copy()
480+
new_domain.attributes[0].attributes["hidden"] = True
481+
data = self.data.transform(new_domain)
482+
self.send_signal(self.widget.Inputs.data, data)
483+
vizrank = ScatterPlotVizRank(self.widget)
484+
self.assertListEqual(
485+
["petal width", "petal length", "sepal width"],
486+
[x.name for x in vizrank.score_heuristic()],
487+
)
488+
475489
def test_auto_send_selection(self):
476490
"""
477491
Scatter Plot automatically sends selection only when the checkbox Send automatically

0 commit comments

Comments
 (0)