Skip to content

Commit e77a619

Browse files
committed
BoxPlot: Fix - show box when one of quartiles equal to meadian
1 parent 1780425 commit e77a619

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Orange/widgets/visualize/owboxplot.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -957,10 +957,13 @@ def line(x0, y0, x1, y1, *args):
957957
var_line = line(stat.mean - stat.dev, 0, stat.mean + stat.dev, 0)
958958
var_line.setPen(self._pen_paramet)
959959
box.extend([whisker1, whisker2, vert_line, mean_line, var_line])
960-
if stat.q25 is not None and stat.q75 is not None:
960+
if stat.q25 is not None or stat.q75 is not None:
961+
# if any of them is None it means that its value is equal to median
962+
box_from = stat.q25 or stat.median
963+
box_to = stat.q75 or stat.median
961964
mbox = FilterGraphicsRectItem(
962-
stat.conditions, stat.q25 * scale_x, -height / 2,
963-
(stat.q75 - stat.q25) * scale_x, height)
965+
stat.conditions, box_from * scale_x, -height / 2,
966+
(box_to - box_from) * scale_x, height)
964967
mbox.setBrush(self._box_brush)
965968
mbox.setPen(QPen(Qt.NoPen))
966969
mbox.setZValue(-200)

0 commit comments

Comments
 (0)