Black Lives Matter. Please consider donating to Black Girls Code today.
Learn about the upcoming Dash Enterprise 4.0 release in the August 5th webinar with Chris Parmer, the Inventor of Dash.

Unable to see negative log axis Scatter plot

Hi,

I am trying to plot data sets which may/may not contain negative values on a log scale.

I am unable to see the point with negative value. Can you please help me out?

https://jsfiddle.net/5a52q1c9/1/

I’m not sure exactly what it should show.

You want the y-axis tick to span below y=0+ ?

yes… as of now the dataset is getting cut off… but if I use normal scale in my actual plot, the plot becomes cluttered.

I was wondering if there is a way to have the negative values also displayed using log scale

I see.

Our log axis don’t extend to negative numbers by design (consistent with Math.log(/* any negative number */) yielding NaN).

Other graphing libraries go around this problem by adding a different axis type often called symlog.

Someone did ask for symlog axes in plotly.js a few months ago. But it isn’t part of our short-term goals, so don’t expect that feature to be implemented anytime soon. You can subscribe to https://github.com/plotly/plotly.js/issues/221 for the latest development info.

You can use an approach in which you can take the absolute of negative number, calculating it’s log, and then plotting that point on the negative axis of the logarithmic scale. I hope this can be done. It is a much needed feature. Please comment.

2 Likes

It is not a priority for us at the moment unfortunately.

Hey, do we have an update for this?

Just to chime in here, one possible solution would be to simply color the positive and negative values differently and still have them on the same axis. This would be the simplest workaround. Another option would be to setup a two plot subplot figure and separately plot the positive and negative values on each, then simply reverse the log scale on the bottom plot to achieve the desired effect. I am not 100% sure if you can reverse the axis in a log plot though.