@@ -43,7 +43,34 @@
* @include: igt_plots.h
*
* A drawing is better than a long speech. Plotting data can reveal surprises
- * and the igt_plot_t object let you do just that.
+ * and igt_plot_t lets you do just that.
+ *
+ * To draw a plot, one needs to populate 2 #igt_vector_t for the X and Y axis
+ * and draw the result.
+ *
+ * |[
+ * static double f(double x)
+ * {
+ * return sin(2 * M_PI * x);
+ * }
+ *
+ * void draw_plot(void)
+ * {
+ * igt_vector_t *x, *y;
+ * igt_plot_t plot;
+ *
+ * x = igt_vector_linear(-1.0, 1.0, 200);
+ * y = igt_vector_map(x, f);
+ *
+ * igt_plot_init(&plot, 800, 600);
+ * igt_plot_set_title(&plot, "f(x) = sin(2?x)");
+ * igt_plot_axis_set_title(&plot.x_axis, "x");
+ * igt_plot_axis_set_title(&plot.y_axis, "f(x)");
+ * igt_plot_set_color(&plot, 0.0, 0.0, 1.0, 1.0);
+ * igt_plot_draw(&plot, x, y);
+ * igt_plot_write(&plot, "test_simple_plot.png");
+ * }
+ * ]|
*/
/* snap to pixel */
Unfortunately, I didn't manage to make the image inclusion work... Signed-off-by: Damien Lespiau <damien.lespiau@intel.com> --- lib/igt_plot.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)