rrdtool-1.x icon indicating copy to clipboard operation
rrdtool-1.x copied to clipboard

add support for negative logarithms

Open mmitch opened this issue 8 years ago • 4 comments

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?

mmitch avatar Dec 03 '16 19:12 mmitch

see this script for a working demonstration: https://gist.github.com/mmitch/6a7e4bda057d0b4ae2d46515f5a30f7a

mmitch avatar Dec 03 '16 20:12 mmitch

Doesn't slog10(0.1) and slog(-10) get the same value?

dword1511 avatar Nov 16 '17 03:11 dword1511

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).

mmitch avatar Nov 16 '17 20:11 mmitch

if memory serves I am cutting values <=1 since there is a discontinuity

oetiker avatar Nov 17 '17 08:11 oetiker