summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2019-05-13 07:45:26 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2019-05-13 08:42:42 +0100
commit15788d264e9804a876c88167cb18ad506c7ede05 (patch)
tree266bfbb470412a197d7d5ee85553af82f11bfef2
parentc201cd58c24f5fe611b63cf1a71cc6953538fe96 (diff)
better-bars
-rw-r--r--ministat.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ministat.c b/ministat.c
index fee047b..d611d20 100644
--- a/ministat.c
+++ b/ministat.c
@@ -358,7 +358,7 @@ PlotSet(struct dataset *ds, int val)
}
i = -1;
for (n = 0; n < ds->n; n++) {
- x = (ds->points[n] - pl->x0) / pl->dx;
+ x = floor((ds->points[n] - pl->x0) / pl->dx);
if (x == i) {
j++;
} else {
@@ -368,17 +368,17 @@ PlotSet(struct dataset *ds, int val)
pl->data[j * pl->width + x] |= val;
}
if (!isnan(Stddev(ds))) {
- x = ((Avg(ds) - Stddev(ds)) - pl->x0) / pl->dx;
- m = ((Avg(ds) + Stddev(ds)) - pl->x0) / pl->dx;
+ x = floor(((Avg(ds) - Stddev(ds)) - pl->x0) / pl->dx);
+ m = ceil(((Avg(ds) + Stddev(ds)) - pl->x0) / pl->dx);
pl->bar[bar][m] = '|';
pl->bar[bar][x] = '|';
for (i = x + 1; i < m; i++)
if (pl->bar[bar][i] == 0)
pl->bar[bar][i] = '_';
}
- x = (Median(ds) - pl->x0) / pl->dx;
+ x = floor((Median(ds) - pl->x0) / pl->dx);
pl->bar[bar][x] = 'M';
- x = (Avg(ds) - pl->x0) / pl->dx;
+ x = floor((Avg(ds) - pl->x0) / pl->dx);
pl->bar[bar][x] = 'A';
}