Skip to content

Commit 89cbe5c

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

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

Orange/widgets/visualize/owscatterplot.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,11 @@ def bar_length(self, score):
8787

8888
def score_heuristic(self):
8989
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()]
90+
vars = [
91+
v
92+
for v in self.master.xy_model # same attributes that are in xy combos
93+
if v is not self.attr_color and v.is_primitive()
94+
]
9395
domain = Domain(attributes=vars, class_vars=self.attr_color)
9496
data = self.master.data.transform(domain)
9597
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)