How to Handle 0 values on log scales
See original GitHub issueref: https://github.com/bokeh/bokeh/issues/6517 ref: https://github.com/bokeh/bokeh/issues/8061
Here is the screenshot of 1D histogram, drawn with multi_line
and y_axis_type="log"
in bokeh==0.12.4. Background was done using plot.patch
Same plot using 0.12.6:
Also in 0.12.6, .patch
is used for plotting blue background
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:18 (12 by maintainers)
Top Results From Across the Web
How to deal with zero in log plot - Stack Overflow
The data represents relative occurences of a feature in dependence of some parameters. The value zero occurs when that feature is not observed ......
Read more >Dealing with Zeros and Negative Values with a Log Scale
A log-scaled axis does have its limitations, though. Namely, values cannot be zero or negative, since the logarithm of those values are not ......
Read more >Dealing with zeros when plotting log-scaled data [closed]
2 Answers 2 · Drop the zero value rows e.g. df = df[df['column'] !=0] but then you lose some data. · Fill the...
Read more >How to display 0 on a log-transformed y axis ? - General
Hi everyone ! On an actual dataset (that comports some point y = 0) where the values can be far from each other...
Read more >How to read a log scale: The chart that can't start at zero
1000 has three zeros, so we can write it as 10 3. The 1 has no zeros, so that's 100. And a 0.0001...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Numpy handles 0 values in log axes properly. They (conceptually) map to -inf, which has the following implications
Line plot example:
x = [1, 2, 3], y = [1, 0, 2] would become x = [1, 1, 3, 3], y = [1, -ymin, -ymin, 2] where ymin is a value that must always be below the bottom of the y axis limits, ideally even when zooming out.
Bar plot. Zero bars are conceptually the same as the line plot, just applied to bars.
This is really valuable for plotting probability distributions and histograms that have zero bins, and I hope Bokeh will match something like the behavior of numpy/pyplot.
I am not sure anything uses (single value) compute, it’s there for completeness but I can’t say if anything uses it for sure.
IIRC in our usage source is data space and target is screen