From: John Darrington Date: Tue, 16 Feb 2016 11:35:17 +0000 (+0100) Subject: Boxplot: Do not attempt to draw whiskers if they are not defined X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=61048d83fca0063d3205ccabe0c610346fca905b Boxplot: Do not attempt to draw whiskers if they are not defined --- diff --git a/src/output/charts/boxplot-cairo.c b/src/output/charts/boxplot-cairo.c index a35b277b8c..d798bc2abb 100644 --- a/src/output/charts/boxplot-cairo.c +++ b/src/output/charts/boxplot-cairo.c @@ -113,14 +113,20 @@ boxplot_draw_box (cairo_t *cr, const struct xrchart_geometry *geom, /* Draw centre line. (bottom half) */ - cairo_move_to (cr, box_centre, bottom_whisker); - cairo_line_to (cr, box_centre, box_bottom); - cairo_stroke (cr); + if (! isnan (whisker[0])) + { + cairo_move_to (cr, box_centre, bottom_whisker); + cairo_line_to (cr, box_centre, box_bottom); + cairo_stroke (cr); + } - /* (top half) */ - cairo_move_to (cr, box_centre, top_whisker); - cairo_line_to (cr, box_centre, box_top); - cairo_stroke (cr); + if (! isnan (whisker[1])) + { + /* (top half) */ + cairo_move_to (cr, box_centre, top_whisker); + cairo_line_to (cr, box_centre, box_top); + cairo_stroke (cr); + } outliers = box_whisker_outliers (bw); for (ll = ll_head (outliers);