1 /* PSPP - computes sample statistics.
2 Copyright (C) 2004 Free Software Foundation, Inc.
3 Written by John Darrington <john@darrington.wattle.id.au>
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 #include <gsl/gsl_histogram.h>
34 /* Array of standard colour names */
35 extern const char *data_colour[];
42 plPlotterParams *pl_params;
49 /* The geometry of the chart
50 See diagram at the foot of this file.
68 /* Default font size for the plot (if zero, then use plotter default) */
73 /* Stuff Particular to Cartesians (and Boxplots ) */
74 double ordinate_scale;
75 double abscissa_scale;
84 struct chart * chart_create(void);
85 void chart_submit(struct chart *ch);
87 double chart_rounded_tick(double tick);
89 void chart_write_xlabel(struct chart *ch, const char *label);
90 void chart_write_ylabel(struct chart *ch, const char *label);
92 void chart_write_title(struct chart *ch, const char *title, ...);
94 enum tick_orientation {
99 void draw_tick(struct chart *ch, enum tick_orientation orientation,
100 double position, const char *label, ...);
111 void draw_barchart(struct chart *ch, const char *title,
112 const char *xlabel, const char *ylabel, enum bar_opts opt);
114 void draw_box_whisker_chart(struct chart *ch, const char *title);
126 void histogram_write_legend(struct chart *ch, const struct normal_curve *norm);
129 /* Plot a gsl_histogram */
130 void histogram_plot(const gsl_histogram *hist, const char *factorname,
131 const struct normal_curve *norm, short show_normal);
134 /* Create a gsl_histogram and set it's parameters based upon
135 x_min, x_max and bins.
136 The caller is responsible for freeing the histogram.
138 gsl_histogram * histogram_create(double bins, double x_min, double x_max) ;
152 /* Draw a piechart */
153 void piechart_plot(const char *title,
154 const struct slice *slices, int n_slices);
156 void draw_scatterplot(struct chart *ch);
159 void draw_lineplot(struct chart *ch);
162 /* Set the scale on chart CH.
163 The scale extends from MIN to MAX .
164 TICK is the approximate number of tick marks.
167 void chart_write_xscale(struct chart *ch,
168 double min, double max, int ticks);
170 void chart_write_yscale(struct chart *ch,
171 double min, double max, int ticks);
174 void chart_datum(struct chart *ch, int dataset, double x, double y);
179 void boxplot_draw_boxplot(struct chart *ch,
186 void boxplot_draw_yscale(struct chart *ch , double y_max, double y_min);
196 void chart_line(struct chart *ch, double slope, double intercept,
197 double limit1, double limit2, enum CHART_DIM limit_d);
203 The anatomy of a chart is as follows.
205 +-------------------------------------------------------------+
206 | +----------------------------------+ |
210 | +----------------------------------+ |
211 |+----------++----------------------------------++-----------+|
222 || Ordinate || Data || Legend ||
233 |+----------++----------------------------------++-----------+| --
234 | +----------------------------------+ | - ^ data_bottom
236 | | | | | abscissa_top
237 | +----------------------------------+ | v v
238 +-------------------------------------------------------------+ ----
248 |<--------------------------------------------->|| |
250 |<---------------------------------------------->| |
252 |<---------------------------------------------------------->|