-/* Write the legend of the chart */
-static void
-histogram_write_legend (struct chart *ch, double n, double mean, double stddev)
-{
- double y;
- char buf[100];
-
- if (!ch)
- return ;
-
- y = ch->data_bottom;
- pl_savestate_r (ch->lp);
-
- if (n != SYSMIS)
- {
- sprintf (buf, "N = %.2f", n);
- pl_move_r (ch->lp, ch->legend_left, y);
- pl_alabel_r (ch->lp, 0, 'b', buf);
- y += ch->font_size * 1.5;
- }
-
- if (mean != SYSMIS)
- {
- sprintf (buf, "Mean = %.1f", mean);
- pl_fmove_r (ch->lp,ch->legend_left, y);
- pl_alabel_r (ch->lp, 0, 'b', buf);
- y += ch->font_size * 1.5;
- }
-
- if (stddev != SYSMIS)
- {
- sprintf (buf, "Std. Dev = %.2f", stddev);
- pl_fmove_r (ch->lp, ch->legend_left, y);
- pl_alabel_r (ch->lp, 0, 'b', buf);
- }
-
- pl_restorestate_r (ch->lp);
-}
-
-static void hist_draw_bar (struct chart *ch, const struct histogram *hist, int bar);
-
-
-static void
-hist_draw_bar (struct chart *ch, const struct histogram *hist, int bar)
-{
- if (!ch)
- return ;
-
- {
- double upper;
- double lower;
- double height;
-
- const size_t bins = gsl_histogram_bins (hist->gsl_hist);
- const double x_pos = (ch->data_right - ch->data_left) * bar / (double) bins ;
- const double width = (ch->data_right - ch->data_left) / (double) bins ;
-
- assert ( 0 == gsl_histogram_get_range (hist->gsl_hist, bar, &lower, &upper));
-
- assert ( upper >= lower);
-
- height = gsl_histogram_get (hist->gsl_hist, bar) *
- (ch->data_top - ch->data_bottom) / gsl_histogram_max_val (hist->gsl_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_filltype_r (ch->lp,1);
-
-
- pl_fboxrel_r (ch->lp,
- x_pos, 0,
- x_pos + width, height);
-
- pl_restorestate_r (ch->lp);
-
- {
- char buf[5];
- snprintf (buf,5,"%g", (upper + lower) / 2.0);
- draw_tick (ch, TICK_ABSCISSA,
- x_pos + width / 2.0, buf);
- }
- }
-}
-
-
-