@@ -407,8 +407,11 @@ def compute_box_data(self):
407407 dataset , attr , self .group_var )
408408 if self .is_continuous :
409409 self .stats = [BoxData (cont , attr , i , self .group_var )
410- for i , cont in enumerate (self .conts )]
411- self .label_txts_all = self .group_var .values
410+ for i , cont in enumerate (self .conts )
411+ if np .sum (cont ) > 0 ]
412+ self .label_txts_all = \
413+ [v for v , c in zip (self .group_var .values , self .conts )
414+ if np .sum (c ) > 0 ]
412415 else :
413416 self .dist = distribution .get_distribution (dataset , attr )
414417 self .conts = []
@@ -528,14 +531,17 @@ def display_changed_disc(self):
528531 if self .group_var :
529532 self .labels = [
530533 QGraphicsTextItem ("{}" .format (int (sum (cont ))))
531- for cont in self .conts ]
534+ for cont in self .conts if np . sum ( cont ) > 0 ]
532535 else :
533536 self .labels = [
534537 QGraphicsTextItem (str (int (sum (self .dist ))))]
535538
536539 self .draw_axis_disc ()
537540 if self .group_var :
538- self .boxes = [self .strudel (cont , i ) for i , cont in enumerate (self .conts )]
541+ self .boxes = \
542+ [self .strudel (cont , i ) for i , cont in enumerate (self .conts )
543+ if np .sum (cont ) > 0 ]
544+ self .conts = self .conts [np .sum (np .array (self .conts ), axis = 1 ) > 0 ]
539545 else :
540546 self .boxes = [self .strudel (self .dist )]
541547
@@ -767,6 +773,8 @@ def draw_axis_disc(self):
767773 Draw the horizontal axis and sets self.scale_x for discrete attributes
768774 """
769775 if self .stretched :
776+ if not self .attr_labels :
777+ return
770778 step = steps = 10
771779 else :
772780 if self .group_var :
0 commit comments