diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2012-11-12 18:46:14 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2012-11-12 18:46:14 -0800 |
commit | 79798dc15b19cda2b498ebfdeea0dfafee1db365 (patch) | |
tree | 2d393f27bf86d59fd652db8db41821a717ee84c4 | |
parent | 05b55542c82fc6842afd68c972b18e86a6c1d004 (diff) | |
download | subsurface-79798dc15b19cda2b498ebfdeea0dfafee1db365.tar.gz |
Improve visual appearance of temperature plot
Prervent tiny temperature changes from being exaggerated in the plot.
Also, shift pressure plot around a bit (if necessary) to prevent it from
ending in the same space as the temperature plato on the profile graph.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | profile.c | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -33,8 +33,9 @@ struct plot_info { int nr; int maxtime; int meandepth, maxdepth; - int maxpressure; - int mintemp, maxtemp; + int endpressure, maxpressure; + int mintemp, maxtemp, endtemp; + double endtempcoord; struct plot_data { unsigned int same_cylinder:1; unsigned int cylinderindex; @@ -1050,16 +1051,16 @@ static int setup_temperature_limits(struct graphics_context *gc, struct plot_inf /* 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; - else - gc->topy = maxtemp + 1500 + delta*2; + if (delta < 3000) /* less than 3K in fluctuation */ + delta = 3000; + gc->topy = maxtemp + delta*2; if (GRAPHS_ENABLED) gc->bottomy = mintemp - delta * 2; else - gc->bottomy = mintemp - delta / 2; + gc->bottomy = mintemp - delta / 3; + pi->endtempcoord = SCALEY(gc, pi->endtemp); return maxtemp > mintemp; } @@ -1151,7 +1152,13 @@ static int get_cylinder_pressure_range(struct graphics_context *gc, struct plot_ else gc->bottomy = 0; gc->topy = pi->maxpressure * 1.5; - return pi->maxpressure != 0; + if (!pi->maxpressure) + return FALSE; + + while (pi->endtempcoord <= SCALEY(gc, pi->endpressure - (gc->topy) * 0.1)) + gc->bottomy -= gc->topy * 0.1; + + return TRUE; } /* set the color for the pressure plot according to temporary sac rate @@ -1395,6 +1402,7 @@ static struct plot_info *analyze_plot_info(struct plot_info *pi) if (pressure) { if (pressure > pi->maxpressure) pi->maxpressure = pressure; + pi->endpressure = pressure; } if (temperature) { @@ -1402,6 +1410,7 @@ static struct plot_info *analyze_plot_info(struct plot_info *pi) pi->mintemp = temperature; if (temperature > pi->maxtemp) pi->maxtemp = temperature; + pi->endtemp = temperature; } } |