rrdtool-1.x
rrdtool-1.x copied to clipboard
add support for negative logarithms
Define a signed logarithm function that works like this:
x >= 0 : slog10(x) = log10( x )
x < 0 : slog10(x) = - log10( -x )
This will allow drawing both above und below the X axis when using logarithmic scale.
Current limitations:
- Y autoscale does not detect negative values,
--lower-limit
has to be used - Y axis labeling is missing
Can anybody help me to solve these problems?
see this script for a working demonstration: https://gist.github.com/mmitch/6a7e4bda057d0b4ae2d46515f5a30f7a
Doesn't slog10(0.1) and slog(-10) get the same value?
Strictly mathematically speaking: yes.
But I have not yet seen an rrdgraph logarithmic diagram with negative values. I think the values are autoscaled in such a way that x never is less than 1 (at least the numeric value of x - the axis legend will happily show a scale of 1/10 or 1/1000 using prefixes like m
or u
).
if memory serves I am cutting values <=1 since there is a discontinuity