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., 59 Temple Place - Suite 330, Boston, MA
26 #include <gsl/gsl_histogram.h>
31 /* Array of standard colour names */
32 extern const char *data_colour[];
38 plPlotterParams *pl_params;
40 /* The geometry of the chart
41 See diagram at the foot of this file.
59 /* Default font size for the plot (if zero, then use plotter default) */
64 /* Stuff Particular to Cartesians */
65 double ordinate_scale;
66 double abscissa_scale;
75 int chart_initialise(struct chart *ch);
77 void chart_finalise(struct chart *ch);
81 void chart_write_xlabel(struct chart *ch, const char *label);
82 void chart_write_ylabel(struct chart *ch, const char *label);
84 void chart_write_title(struct chart *ch, const char *title, ...);
86 enum tick_orientation {
91 void draw_tick(struct chart *ch, enum tick_orientation orientation,
92 double position, const char *label, ...);
103 void draw_barchart(struct chart *ch, const char *title,
104 const char *xlabel, const char *ylabel, enum bar_opts opt);
106 void draw_box_whisker_chart(struct chart *ch, const char *title);
118 void histogram_write_legend(struct chart *ch, const struct normal_curve *norm);
121 void histogram_plot(const gsl_histogram *hist, const char *factorname,
122 const struct normal_curve *norm, short show_normal);
135 /* Draw a piechart */
136 void piechart_plot(const char *title,
137 const struct slice *slices, int n_slices);
139 void draw_scatterplot(struct chart *ch);
142 void draw_lineplot(struct chart *ch);
145 /* Set the scale on chart CH.
146 The scale extends from MIN to MAX .
147 TICK is the approximate number of tick marks.
150 void chart_write_xscale(struct chart *ch,
151 double min, double max, int ticks);
153 void chart_write_yscale(struct chart *ch,
154 double min, double max, int ticks);
157 void chart_datum(struct chart *ch, int dataset, double x, double y);
168 void chart_line(struct chart *ch, double slope, double intercept,
169 double limit1, double limit2, enum CHART_DIM limit_d);
175 The anatomy of a chart is as follows.
177 +-------------------------------------------------------------+
178 | +----------------------------------+ |
182 | +----------------------------------+ |
183 |+----------++----------------------------------++-----------+|
194 || Ordinate || Data || Legend ||
205 |+----------++----------------------------------++-----------+| --
206 | +----------------------------------+ | - ^ data_bottom
208 | | | | | abscissa_top
209 | +----------------------------------+ | v v
210 +-------------------------------------------------------------+ ----
220 |<--------------------------------------------->|| |
222 |<---------------------------------------------->| |
224 |<---------------------------------------------------------->|