Skip to content

Commit

Permalink
Box Plot: Add box for missing group values
Browse files Browse the repository at this point in the history
  • Loading branch information
PrimozGodec committed Dec 30, 2019
1 parent b3c1e8c commit 250c582
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Orange/widgets/visualize/owboxplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,20 +494,21 @@ def compute_box_data(self):
self.dist = []
self.conts = contingency.get_contingency(
dataset, attr, self.group_var)
group_var_labels = self.group_var.values + [
f"Missing {self.group_var.name}"]
if self.is_continuous:
stats, label_texts = [], []
for i, cont in enumerate(self.conts):
for i, cont in enumerate(self.conts.array_with_unknowns):
if np.sum(cont[1]):
stats.append(BoxData(cont, attr, i, self.group_var))
label_texts.append(self.group_var.values[i])
label_texts.append(group_var_labels[i])
self.stats = stats
self.label_txts_all = label_texts
else:
self.label_txts_all = \
[v for v, c in zip(
self.group_var.values + ["Missing values"],
self.conts.array_with_unknowns)
if np.sum(c) > 0]
self.label_txts_all = [
v for v, c in zip(
group_var_labels, self.conts.array_with_unknowns)
if np.sum(c) > 0]
else:
self.dist = distribution.get_distribution(dataset, attr)
self.conts = []
Expand Down Expand Up @@ -1071,7 +1072,7 @@ def strudel(self, dist, group_val_index=None):
cond.append(FilterDiscrete(self.group_var, [group_val_index]))
box.append(FilterGraphicsRectItem(cond, 0, -10, 1, 10))
cum = 0
values = attr.values + ["Missing values"]
values = attr.values + [f"Missing {attr.name}"]
colors = np.vstack((attr.colors, [128, 128, 128]))
for i, v in enumerate(dist):
if v < 1e-6:
Expand Down

0 comments on commit 250c582

Please sign in to comment.