X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=profile.c;h=7cad699ceaae7a868d3126f1c8072cf1ebf97845;hb=296642a63236ed4dbf72ba544164961cab51fcac;hp=35a1366bffd90dc42e95edd14fe00f9cd6af951a;hpb=f3e70c5496c4da8f1b0b78fa13d8e06908ac12e9;p=ext%2Fsubsurface.git diff --git a/profile.c b/profile.c index 35a1366..7cad699 100644 --- a/profile.c +++ b/profile.c @@ -300,7 +300,7 @@ static void plot_depth_profile(struct graphics_context *gc, struct plot_info *pi static int setup_temperature_limits(struct graphics_context *gc, struct plot_info *pi) { - int maxtime, mintemp, maxtemp; + int maxtime, mintemp, maxtemp, delta; /* Get plot scaling limits */ maxtime = get_maxtime(pi); @@ -308,9 +308,16 @@ static int setup_temperature_limits(struct graphics_context *gc, struct plot_inf maxtemp = pi->maxtemp; gc->leftx = 0; gc->rightx = maxtime; - /* Show temperatures in roughly the lower third */ - gc->topy = maxtemp + (maxtemp - mintemp)*2; - gc->bottomy = mintemp - (maxtemp - mintemp)/2; + /* Show temperatures in roughly the lower third, but make sure the scale + is at least somewhat reasonable */ + delta = maxtemp - mintemp; + if (delta > 3000) { /* more than 3K in fluctuation */ + gc->topy = maxtemp + delta*2; + gc->bottomy = mintemp - delta/2; + } else { + gc->topy = maxtemp + 1500 + delta*2; + gc->bottomy = mintemp - delta/2; + } return maxtemp > mintemp; }