question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to Handle 0 values on log scales

See original GitHub issue

ref: 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

screen shot 2017-06-26 at 12 20 45

Same plot using 0.12.6:

screen shot 2017-06-26 at 12 23 16

Also in 0.12.6, .patch is used for plotting blue background

screen shot 2017-06-26 at 12 27 27

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:18 (12 by maintainers)

github_iconTop GitHub Comments

4reactions
erickeecommented, Sep 27, 2017

Numpy handles 0 values in log axes properly. They (conceptually) map to -inf, which has the following implications

  1. 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.

  2. 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.

0reactions
bryevdvcommented, Jan 11, 2019
  • 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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found