Skip to content

Commit 2467507

Browse files
committed
Box Plot: Add box for missing group values
1 parent b3c1e8c commit 2467507

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Orange/widgets/visualize/owboxplot.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -494,20 +494,21 @@ def compute_box_data(self):
494494
self.dist = []
495495
self.conts = contingency.get_contingency(
496496
dataset, attr, self.group_var)
497+
group_var_labels = self.group_var.values + [
498+
f"missing '{self.group_var.name}'"]
497499
if self.is_continuous:
498500
stats, label_texts = [], []
499-
for i, cont in enumerate(self.conts):
501+
for i, cont in enumerate(self.conts.array_with_unknowns):
500502
if np.sum(cont[1]):
501503
stats.append(BoxData(cont, attr, i, self.group_var))
502-
label_texts.append(self.group_var.values[i])
504+
label_texts.append(group_var_labels[i])
503505
self.stats = stats
504506
self.label_txts_all = label_texts
505507
else:
506-
self.label_txts_all = \
507-
[v for v, c in zip(
508-
self.group_var.values + ["Missing values"],
509-
self.conts.array_with_unknowns)
510-
if np.sum(c) > 0]
508+
self.label_txts_all = [
509+
v for v, c in zip(
510+
group_var_labels, self.conts.array_with_unknowns)
511+
if np.sum(c) > 0]
511512
else:
512513
self.dist = distribution.get_distribution(dataset, attr)
513514
self.conts = []
@@ -1071,7 +1072,7 @@ def strudel(self, dist, group_val_index=None):
10711072
cond.append(FilterDiscrete(self.group_var, [group_val_index]))
10721073
box.append(FilterGraphicsRectItem(cond, 0, -10, 1, 10))
10731074
cum = 0
1074-
values = attr.values + ["Missing values"]
1075+
values = attr.values + [f"missing '{attr.name}'"]
10751076
colors = np.vstack((attr.colors, [128, 128, 128]))
10761077
for i, v in enumerate(dist):
10771078
if v < 1e-6:

0 commit comments

Comments
 (0)