Skip to content

Commit

Permalink
Merge pull request #1882 from mstrazar/heatmap_limit_low_high
Browse files Browse the repository at this point in the history
OWHeatmap: consistent threshold limits and attribute checks
(cherry picked from commit e6cdc76)

 Conflicts:
	Orange/widgets/visualize/owheatmap.py
  • Loading branch information
ajdapretnar authored and astaric committed Feb 3, 2017
1 parent d7b42de commit f1d9ccf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Orange/widgets/visualize/owheatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,9 @@ class Error(widget.OWWidget.Error):
no_continuous = Msg("No continuous feature columns")
not_enough_memory = Msg("Not enough memory to show this data")

class Warning(widget.OWWidget.Warning):
threshold_error = Msg("Low slider should be less than High")

def __init__(self):
super().__init__()

Expand Down Expand Up @@ -706,6 +709,13 @@ def set_dataset(self, data=None):
self.Information.sparse_densified()

input_data = data

# Data contains no attributes or meta attributes only
if data is not None and len(data.domain.attributes) == 0:
self.Error.no_continuous()
input_data = data = None

# Data contains some discrete attributes which must be filtered
if data is not None and \
any(var.is_discrete for var in data.domain.attributes):
ndisc = sum(var.is_discrete for var in data.domain.attributes)
Expand Down Expand Up @@ -1396,7 +1406,15 @@ def update_grid_spacing(self):
layout.setSpacing(self.SpaceX)
self.__fixup_grid_layout()

def check_threshold_consistency(self):
return self.threshold_low < self.threshold_high

def update_color_schema(self):
if not self.check_threshold_consistency():
self.Warning.threshold_error()
return
else:
self.Warning.clear()
palette = self.color_palette()
for heatmap in self.heatmap_widgets():
heatmap.set_color_table(palette)
Expand Down

0 comments on commit f1d9ccf

Please sign in to comment.