Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Symlog is symmetric log. It's not arcsinh, instead it's a normal logarithmic scale, that turns into a linear scale around zero (for example in the range [-1,1]) and then it turns into a negative logarithm on the other side of zero. So similar but slightly different.

https://matplotlib.org/stable/gallery/scales/symlog_demo.htm...

for an example.



> that turns into a linear scale around zero

how does this actually work? afaik, there is no log() fn that you can run which "becomes linear". i guess you can wrap a call to log() in another fn that simply does linear scaling below the defined threshold, but it's not a smooth transition without a bunch of extra [possibly slow] smoothing code.

what you're describing is exactly how a straight call to Math.asinh() behaves, and what i have implemented in the above demo.


Theres no smoothing involved, it's three distinct domains with different function definitions. Top part is log(x) from [a,\infty), bottom part is -log(-x) from (-\infty,-a] and the middle part is cx from (-a,a). With c chosen to ensure continuity in the transform.

In the example from matplotlib I linked in the earlier comment they call out that the symlog transform has a discontinous gradient at the a's, and that the asinh transform can be used instead if that's a problem.

Edit: On reflection it's probably not entirely correct to talk about it as choosing an appropriate c. Since that transform seems to kinda break apart around a=1. Simpler to consider it a matter of plotting on a logarithmic scale down to some value. Then continuing the plot on a linear scale until you reach the negative value on the other side and then plotting on a negative logarithmic scale (-log(|x|)).


As the other commenter pointed out, symlog is not smooth. But the point about symlog is that it is very simple, has the familiar and intuitive log scaling, and most importantly that you can select the point where it transitions to linear such that it is below the smallest scale you care about.

All in all, for scientists the symlog is much more useful.


you can specify the linear threshold for asinh as well, but the transition is smooth.

asinh also has log scaling beyond this threshold. https://specialfunctionswiki.org/index.php/Arcsinh




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: