X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fplot-hist.c;h=fd1a88d8a69cfbb325723522707eaf8471ff565c;hb=92fb12eb06716d14c05b781f5d9dcde956d77c30;hp=85fb3700e6985b41b7878eddeb37b046035a001b;hpb=fa37636e739d1e407ae6b80d65b256eb34567932;p=pspp diff --git a/src/plot-hist.c b/src/plot-hist.c index 85fb3700e6..fd1a88d8a6 100644 --- a/src/plot-hist.c +++ b/src/plot-hist.c @@ -28,19 +28,20 @@ #include #include #include - #include "hash.h" - #include "var.h" #include "chart.h" +#include "gettext.h" +#define _(msgid) gettext (msgid) + /* Write the legend of the chart */ void histogram_write_legend(struct chart *ch, const struct normal_curve *norm) { char buf[100]; if ( !ch ) - return ; + return ; pl_savestate_r(ch->lp); @@ -120,14 +121,22 @@ histogram_plot(const gsl_histogram *hist, struct chart *ch; - bins = gsl_histogram_bins(hist); - ch = chart_create(); chart_write_title(ch, _("HISTOGRAM")); chart_write_ylabel(ch, _("Frequency")); chart_write_xlabel(ch, factorname); + if ( ! hist ) /* If this happens, probably all values are SYSMIS */ + { + chart_submit(ch); + return ; + } + else + { + bins = gsl_histogram_bins(hist); + } + chart_write_yscale(ch, 0, gsl_histogram_max_val(hist), 5); for ( i = 0 ; i < bins ; ++i )