From e1bf9d1c673752470464ceeb67080fae094398b6 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 14 Jul 2011 15:35:58 +0200 Subject: Add histograms of partialities --- src/scaling-report.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) (limited to 'src') diff --git a/src/scaling-report.c b/src/scaling-report.c index 2f7fdc22..367155e7 100644 --- a/src/scaling-report.c +++ b/src/scaling-report.c @@ -254,6 +254,112 @@ static void partiality_graph(cairo_t *cr, const struct image *images, int n, } +static void partiality_histogram(cairo_t *cr, const struct image *images, + int n, RefList *full, int calc) +{ + int f_max; + int i, b; + const int nbins = 100; + int counts[nbins]; + const double g_width = 320.0; + const double g_height = 180.0; + char tmp[32]; + + + show_text_simple(cr, "Frequency", -15.0, g_height/2.0, + NULL, -M_PI_2, J_CENTER); + if ( calc ) { + show_text_simple(cr, "Distribution of calculated partialities", + g_width/2.0, -18.0, "Sans Bold 10", 0.0, + J_CENTER); + show_text_simple(cr, "Calculated partiality", g_width/2.0, + g_height+12.0, NULL, 0.0, J_CENTER); + } else { + show_text_simple(cr, "Distribution of observed partialities", + g_width/2.0, -18.0, "Sans Bold 10", 0.0, + J_CENTER); + show_text_simple(cr, "Observed partiality", g_width/2.0, + g_height+12.0, NULL, 0.0, J_CENTER); + } + + for ( b=0; b=0) && (b f_max ) f_max = counts[b]; + } + f_max = (f_max/10)*10 + 10; + + show_text_simple(cr, "0", -10.0, g_height, NULL, 0.0, J_RIGHT); + snprintf(tmp, 31, "%i", f_max); + show_text_simple(cr, tmp, -10.0, 0.0, NULL, 0.0, J_RIGHT); + + show_text_simple(cr, "0.0", 0.0, g_height+10.0, + NULL, -M_PI/3.0, J_RIGHT); + show_text_simple(cr, "1.0", g_width, g_height+10.0, + NULL, -M_PI/3.0, J_RIGHT); + + for ( b=0; bsurf); watermark(sr); + cairo_save(sr->cr); + cairo_translate(sr->cr, 75.0, 50.0); + partiality_histogram(sr->cr, images, n, full, 1); + cairo_translate(sr->cr, 400.0, 0.0); + partiality_histogram(sr->cr, images, n, full, 0); + cairo_restore(sr->cr); cairo_surface_finish(sr->surf); cairo_destroy(sr->cr); -- cgit v1.2.3