diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-05-16 08:45:13 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-05-16 08:50:32 +0100 |
commit | 384a04d561dd1b9d08278f12c85465533b984da6 (patch) | |
tree | cecaeb646f78c9aa26f8d1b3e59430fd1cb9a78f | |
parent | 1f9bb7a59773e7dacadd517a3f6f59362a8c9a9e (diff) |
mibibel
-rw-r--r-- | ministat.c | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -309,11 +309,16 @@ DimPlot(struct dataset *ds) AdjPlot(Avg(ds) + Stddev(ds)); } +static int mibibel(int x) +{ + return round(M_E * log(x)); +} + static void PlotSet(struct dataset *ds, int val) { struct plot *pl; - int i, j, m, x; + int i, j, m, x, h; unsigned n; int bar; @@ -342,8 +347,9 @@ PlotSet(struct dataset *ds, int val) x = (ds->points[n] - pl->x0) / pl->dx; if (x == i) { j++; - if (j > m) - m = j; + h = mibibel(j); + if (h > m) + m = h; } else { j = 1; i = x; @@ -356,16 +362,21 @@ PlotSet(struct dataset *ds, int val) (m - pl->height) * pl->width); pl->height = m; } + i = -1; for (n = 0; n < ds->n; n++) { x = floor((ds->points[n] - pl->x0) / pl->dx); if (x == i) { j++; + m = mibibel(j); } else { + h = 0; j = 1; + m = 1; i = x; } - pl->data[j * pl->width + x] |= 1 << val; + while (h < m) + pl->data[++h * pl->width + x] |= 1 << val; } if (!isnan(Stddev(ds))) { x = floor(((Avg(ds) - Stddev(ds)) - pl->x0) / pl->dx); @@ -395,7 +406,9 @@ DumpPlot(void) } putchar('+'); - for (i = 0; i < pl->width; i++) + putchar('m'); + putchar('B'); + for (i = 2; i < pl->width; i++) putchar('-'); putchar('+'); putchar('\n'); |