- const double x = (d - geom->axis[SCALE_ABSCISSA].data_min) / abscissa_scale + x_min;
- const double y = h->n * range *
- gsl_ran_gaussian_pdf (x - h->mean, h->stddev);
-
- cairo_line_to (cr, d, geom->axis[SCALE_ORDINATE].data_min + y * ordinate_scale);
-
+ const double y = gsl_ran_gaussian_pdf (x - h->mean, h->stddev) * ordinate_scale;
+ /* Transform to drawing coordinates */
+ const double x_pos = (x - geom->axis[SCALE_ABSCISSA].min) * geom->axis[SCALE_ABSCISSA].scale + geom->axis[SCALE_ABSCISSA].data_min;
+ const double y_pos = (y - geom->axis[SCALE_ORDINATE].min) * geom->axis[SCALE_ORDINATE].scale + geom->axis[SCALE_ORDINATE].data_min;
+ cairo_line_to (cr, x_pos, y_pos);