-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add symmetrical log scale #221
Comments
This isn't a priority right now, but shouldn't be too difficult to implement down the road. We're always open to pull requests as well! |
maybe any workarounds here without changes in the library itself? for example as in Highcharts http://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/samples/highcharts/yaxis/type-log-negative/ |
@etpinard is there any reason to keep current I can make PR if you show me all places to change exept those I found by myself:
|
symlog is a little funny, as it's not a smooth mapping. A variant I've seen before though that is smooth is arcsinh (inverse hyperbolic sine) - this one is particularly nice as you can define both the zero and the linear-ish range, using |
@alexcjohnson, this is exactly the approach we are taking in our signal processing app where log scale would be ideal but where negative values are commonly present. |
I'm confused now after reading the thread, I'm happy it worked for someone but arcsinh is a little complicated concept. Could somebody explain, can it be used as replacement of symlog somehow? 😳 |
Just for a little more context here - @Melmoth-the-Wanderer apologies for missing your question last fall - symlog is a piecewise combination of three mappings: a regular log mapping at large positive values, a negated log mapping at large negative values, and a linear mapping connecting the two at small positive/negative values. This allows us to show very large positive and negative values while maintaining visibility into small changes in the mid-range. Symlog scales generally have a configurable linearity threshold, and often the ability to offset the zero to account for a baseline value in the data. The problem with this though is it's not a smooth mapping. Matplotlib in fact doesn't seem to worry about anything more than matching values at the breakpoints, leading to kinks like this: That's where It's a single smooth function that approximates a log @PavelGolodoniuc applied this transformation to his data and simply plotted that as |
is there any plan to deliver this feature recently? |
👍 for this feature. |
+1 |
1 similar comment
+1 |
This issue has been tagged with A community PR for this feature would certainly be welcome, but our experience is deeper features like this are difficult to complete without the Plotly maintainers leading the effort. What Sponsorship includes:
Please include the link to this issue when contacting us to discuss. |
Hello fellow symlog users, While I am not in a position to create a proper symlog capability that would result in a pull request, I did need to find a way to do that. I looked at all the various discussion groups I could for examples using the current capability and could not find exactly what I needed. The following link is what I am using to produce a symlog plot in dash/plotly: https://github.com/WarlockUnicorn/dash-plotly-symlog. It may be very simple but it worked for my initial needs. I hope someone finds it useful. Sincerely, |
Thanks @WarlockUnicorn, here's a notebook with your code. Output: This leverages |
@alexcjohnson The "base 10" version of the asinh scale is
Using these mappings, the ticks could be handled basically the same way they are for the log scale. |
I stumbled across this issue because I wanted a quick plot for my list of large numbers with both positive and negative values. In general, I think using linear approximation for symlog in the region around 0 makes sense as long as the region is sufficiently small in the whole picture (just like any first order Taylor's approximation). At the end of the day, even arcsinh are often approximated as linear in the region very close to the origin. The kink in the plot above happens when the linear region is set too large (linear between -20 to 20 while the whole plot is between -50 to 50). It would, of course, be better to use arcsinh for the smoothness, but I would imagine it would be easier to implement the linear version? idk In any case, I have ripped out the symlog used in Matplotlib's implementation, and applying on my data before I input it into plotly. If anyone is interested, this is the Python version and this is the JavaScript version |
Looked up Then computed parallel arrays to use with
Based on @qhelix7 calcs The chart data itself is transformed by the first calc and the ticktext by the second |
yes, this feature is useful. |
Would love to see this feature in plotly! |
Dear fellow developers and plot.ly users,
I would like to request a new feature: "symmetrical log" scale. Matplotlib has it:
http://matplotlib.org/examples/pylab_examples/symlog_demo.html
Also see: What is the difference between 'log' and 'symlog'? link
It would be great if plot.ly can adopt this scale. Thanks!
-- Y
The text was updated successfully, but these errors were encountered: