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.

LogColorMapper maps to wrong values

See original GitHub issue

Possibly related: #8061 Definitely related: #5020

TL;DR I’m happy to make a PR to use log for the LogColorMapper instead of log1p but wanted to hear opinions first.

As of now, LogTicker and LogTickFormatter seem to work with a simple log(x) transform, whereas LogColorMapper does a log(1+x) transform (log1p), which makes the colorbar map to the wrong values. The documentation does not mention the occurence of log1p at all.

So one of these two options has to be used for both cases.

Scientifically, log1p makes absolutely no sense because it makes the transform depend on the unit of the measurement, but in #5020 the reason given was that small values smaller than 10-ish are “usually below the range of values that log is used for”, which I don’t understand at all.

I get the concern that for 0-values, the log scale will blow up, but that’s a problem of choosing the right transform for your data and should be handled by the user, not by bokeh. One could always add separate Log1pColorMapper, Log1pTickFormatter, etc. or something like it if users really need this behaviour for their dimensionless values.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
bryevdvcommented, Sep 28, 2019

@poplarShift I can’t actually find any evidence that other libraries (Altair/Vegalite, MPL, Plotly) handle zero on log scales, except for MPL’s symlog which I think is generally regarded as bad. So I am inclined now to agree with you that we should just do the simple thing and stop using log1p in the colorbar case, and make it match what the other log scales on axes do. Since that is technically a “breaking change” I will move this to the 2.0 milestone. Just FYI most of the work for 2.0 is already done on the landing-2.0 branch so it should be out a matter of weeks after 1.4 is.

Thanks for your patience with this old issue.

0reactions
bryevdvcommented, Oct 3, 2019

@poplarShift If you would like to re-submit that PR against the landing-2.0 branch it would certainly be helpful (or alternatively it could be submitted agains master after 1.4 is released)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem with ticks for custom log_color_mapper allowing ...
The color_mapper itself works great. The data is, even with negative values, mapped correctly. This is the modified LogColorMapper :.
Read more >
How do I get colors on a bokeh plot to line up with their correct ...
I am trying to theme points on a bokeh plot with a log scale coloring scheme, and have a colorbar that goes along...
Read more >
How to plot data on maps in Jupyter using Matplotlib, Plotly ...
How to plot data on maps in Jupyter using Matplotlib, Plotly, and Bokeh ... If you're trying to plot geographical data on a...
Read more >
Your colour map is bad, here's how to fix it | by Thomas Bury
Many common colour maps distort data through uneven colour gradients and are often unreadable to those with colour-vision deficiency. An infamous example is...
Read more >
Bokeh - freshcode.club
#8724 component: bokehjs Logcolormapper maps to wrong values. - #9108 component: bokehjs layout incorrect initialization when loading out of focus.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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