/* PSPP - a program for statistical analysis.
- Copyright (C) 2009, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2011, 2014 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "output/charts/plot-hist.h"
+#include <float.h>
#include <gsl/gsl_randist.h>
#include "data/val-type.h"
assert ( upper >= lower);
- height = gsl_histogram_get (h, bar) /
- (geom->axis[SCALE_ORDINATE].max - geom->axis[SCALE_ORDINATE].min) *
- (geom->axis[SCALE_ORDINATE].data_max - geom->axis[SCALE_ORDINATE].data_min);
+ height = geom->axis[SCALE_ORDINATE].scale * gsl_histogram_get (h, bar);
cairo_rectangle (cr,
geom->axis[SCALE_ABSCISSA].data_min + x_pos,
cairo_stroke (cr);
if (label)
- draw_tick (cr, geom, SCALE_ABSCISSA,
- x_pos + width / 2.0, "%g", (upper + lower) / 2.0);
+ draw_tick (cr, geom, SCALE_ABSCISSA, bins > 10,
+ x_pos + width / 2.0, "%.*g",
+ DBL_DIG + 1, (upper + lower) / 2.0);
}
void