X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Foutput%2Fcharts%2Fplot-hist.c;h=0f183208a2486ac5c4e07c4fd325b4bbf6a12d6d;hb=bd00412ff6cf29cf3b7744bf1045f53122eb46f7;hp=14674a14884390324eff9ca9906cac7011f7dcdf;hpb=164d1274fcb70c54897f2a03fc7c27152ed4821a;p=pspp-builds.git
diff --git a/src/output/charts/plot-hist.c b/src/output/charts/plot-hist.c
index 14674a14..0f183208 100644
--- a/src/output/charts/plot-hist.c
+++ b/src/output/charts/plot-hist.c
@@ -1,20 +1,18 @@
-/* PSPP - computes sample statistics.
+/* PSPP - a program for statistical analysis.
Copyright (C) 2004 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 the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
+ 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
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- 02110-1301, USA. */
+ along with this program. If not, see . */
#include
@@ -58,7 +56,7 @@ histogram_write_legend(struct chart *ch, const struct normal_curve *norm)
pl_fmove_r(ch->lp,ch->legend_left,ch->data_bottom + ch->font_size * 1.5 * 2);
pl_alabel_r(ch->lp,0,'b',buf);
- pl_restorestate_r(ch->lp);
+ pl_restorestate_r(ch->lp);
}
static void hist_draw_bar(struct chart *ch, const gsl_histogram *hist, int bar);
@@ -67,7 +65,7 @@ static void hist_draw_bar(struct chart *ch, const gsl_histogram *hist, int bar);
static void
hist_draw_bar(struct chart *ch, const gsl_histogram *hist, int bar)
{
- if ( !ch )
+ if ( !ch )
return ;
@@ -85,12 +83,12 @@ hist_draw_bar(struct chart *ch, const gsl_histogram *hist, int bar)
assert( upper >= lower);
- height = gsl_histogram_get(hist, bar) *
+ height = gsl_histogram_get(hist, bar) *
(ch->data_top - ch->data_bottom) / gsl_histogram_max_val(hist);
pl_savestate_r(ch->lp);
pl_move_r(ch->lp,ch->data_left, ch->data_bottom);
- pl_fillcolorname_r(ch->lp, ch->fill_colour);
+ pl_fillcolorname_r(ch->lp, ch->fill_colour);
pl_filltype_r(ch->lp,1);
@@ -119,7 +117,7 @@ histogram_plot(const gsl_histogram *hist,
{
int i;
int bins;
-
+
struct chart *ch;
ch = chart_create();
@@ -140,14 +138,14 @@ histogram_plot(const gsl_histogram *hist,
chart_write_yscale(ch, 0, gsl_histogram_max_val(hist), 5);
- for ( i = 0 ; i < bins ; ++i )
+ for ( i = 0 ; i < bins ; ++i )
hist_draw_bar(ch, hist, i);
histogram_write_legend(ch, norm);
if ( show_normal )
{
- /* Draw the normal curve */
+ /* Draw the normal curve */
double d ;
double x_min, x_max, not_used ;
@@ -158,19 +156,18 @@ histogram_plot(const gsl_histogram *hist,
gsl_histogram_get_range(hist, 0, &x_min, ¬_used);
range = not_used - x_min;
gsl_histogram_get_range(hist, bins - 1, ¬_used, &x_max);
- assert(range == x_max - not_used);
abscissa_scale = (ch->data_right - ch->data_left) / (x_max - x_min);
- ordinate_scale = (ch->data_top - ch->data_bottom) /
+ ordinate_scale = (ch->data_top - ch->data_bottom) /
gsl_histogram_max_val(hist) ;
- pl_move_r(ch->lp, ch->data_left, ch->data_bottom);
- for( d = ch->data_left;
- d <= ch->data_right ;
+ pl_move_r(ch->lp, ch->data_left, ch->data_bottom);
+ for( d = ch->data_left;
+ d <= ch->data_right ;
d += (ch->data_right - ch->data_left) / 100.0)
- {
- const double x = (d - ch->data_left) / abscissa_scale + x_min ;
- const double y = norm->N * range *
+ {
+ const double x = (d - ch->data_left) / abscissa_scale + x_min ;
+ const double y = norm->N * range *
gsl_ran_gaussian_pdf(x - norm->mean, norm->stddev);
pl_fcont_r(ch->lp, d, ch->data_bottom + y * ordinate_scale);