@@ -476,6 +476,10 @@ class Information(widget.OWWidget.Information):
476476
477477 class Error (widget .OWWidget .Error ):
478478 no_continuous = Msg ("No continuous feature columns" )
479+ not_enough_features = Msg ("Not enough features for column clustering" )
480+ not_enough_instances = Msg ("Not enough instances" )
481+ not_enough_instances_k_means = Msg (
482+ "Not enough instances for k-means merging" )
479483 not_enough_memory = Msg ("Not enough memory to show this data" )
480484
481485 class Warning (widget .OWWidget .Warning ):
@@ -753,10 +757,22 @@ def set_dataset(self, data=None):
753757 def update_heatmaps (self ):
754758 if self .data is not None :
755759 self .clear_scene ()
756- self .construct_heatmaps (self .data )
757- self .construct_heatmaps_scene (
758- self .heatmapparts , self .effective_data )
759- self .selected_rows = []
760+ self .clear_messages ()
761+ if self .sort_columns not in (OWHeatMap .NoSorting ,) and \
762+ len (self .data .domain .attributes ) < 2 :
763+ self .Error .not_enough_features ()
764+ elif (self .sort_columns not in (OWHeatMap .NoSorting ,) or
765+ self .sort_rows not in (OWHeatMap .NoSorting ,
766+ OWHeatMap .SortBarycenter )) and \
767+ len (self .data ) < 2 :
768+ self .Error .not_enough_instances ()
769+ elif self .merge_kmeans and len (self .data ) < 3 :
770+ self .Error .not_enough_instances_k_means ()
771+ else :
772+ self .construct_heatmaps (self .data )
773+ self .construct_heatmaps_scene (
774+ self .heatmapparts , self .effective_data )
775+ self .selected_rows = []
760776 else :
761777 self .clear ()
762778 self .commit ()
@@ -1423,12 +1439,10 @@ def update_color_schema(self):
14231439 legend .set_color_table (palette )
14241440
14251441 def update_sorting_examples (self ):
1426- if self .effective_data is not None :
1427- self .update_heatmaps ()
1442+ self .update_heatmaps ()
14281443
14291444 def update_sorting_attributes (self ):
1430- if self .effective_data is not None :
1431- self .update_heatmaps ()
1445+ self .update_heatmaps ()
14321446
14331447 def update_legend (self ):
14341448 for item in self .heatmap_scene .items ():
@@ -1538,7 +1552,6 @@ def commit(self):
15381552 data = None
15391553 indices = None
15401554 if self .merge_kmeans :
1541- assert self .merge_indices is not None
15421555 merge_indices = self .merge_indices
15431556 else :
15441557 merge_indices = None
0 commit comments