log_x not working in histogram
Hi,
I'm new to plotly and it seems to me that following behavior is a bug.
Can someone please verify it?
Thanks for a great library.
from plotly import express as px
# this works just fine
px.histogram(np.random.randint(0, 8, 100), log_y=True, log_x=False)
# but this "works" but it produces an empty plot, no errors are raised
px.histogram(np.random.randint(0, 8, 100), log_y=False, log_x=True)
It's not a bug, we just have not yet implemented histograms on log scales :)
Thanks for the prompt reply, but the strange thing is that it works on log_y.
Would also be useful if it was throwing a "NonImplementedError"
That's a good idea! Should be fairly straightforward to implement in PX since the recent changes to explicitize orientation if you're up to submit a PR!
Sure I can do that but I have no idea where to look for things. I have not looked at this repo in any way
It'll be in a file called _core.py (sorry, replying from my phone, can't find full path just now ;)
@nicolaskruchten have log scale histograms been implemented anywhere yet? if not i can add look into adding this NotImplementedError.
I'm having the same problem, would be awesome to have this implemented or make it throw NotImplementedError. Thank you!
For my use case, I made an implementation using numpy to build the histogram and plot it with a Bar plot customizing the ticks and hover data.
https://gist.github.com/acssantos/3108539189e60e4b059130259d21f5a9
Hope it can help circumvent the problem.
So there is in fact a bug here, sorry to have misdiagnosed it earlier. Setting log_x=True causes the x-axis to become logarithmic, and when a bin edge is 0, the bars disappears. I've filed a bug in the upstream Plotly.js repo to fix this.
Note that setting log_x=True does not cause the bin edge calculation to change, so your bins will appear to be of different widths, as they do right now if you don't have a bin edge at 0.
- Upstream issue: https://github.com/plotly/plotly.js/issues/6200
Any progress?
Hi @Msx1998 - this one isn't currently on our roadmap, but we'd be happy to review a pull request from the community. Thanks - @gvwilson
Is this still not implemented? I'm having the same issue.