Image glyph on log scale... bad idea

Hi, I just want to point out something I just ran into.

There is a heatmap type plot I am trying to make. My original plan was to use the Image glyph because it’s fast and the hovertool options now available for it are exactly what I need.

However, the wrench in it is that the figure I am plotting it on has an log scaled axis. I wondered how the image glyph would behave:

import numpy as np
from bokeh.plotting import figure, output_notebook,show
from bokeh.models import HoverTool

img = np.arange(50).reshape(5,10)
# img2 = np.random.rand(10,5)
img2 = np.arange(50).reshape(5,10)
hover = HoverTool(tooltips=[
    ('index', '$index'),

p = figure(plot_width=400,plot_height=400,tools=[hover]


What happens is that the image anchors in the correct place and stretches over the right bounds, but the pixels all have the same widths… which is basically how an image should behave and I understand why. But, it is wrong/misleading in terms of displaying the data on the plot, as really… the colors should not be evenly spaced here. There are no warnings for this etc.

The two solutions I’ve identified are

  1. resample the heatmap image to the smallest pixels only (pain in the butt)
  2. use Quad glyph instead (slower but probably easier to implement)

Just thought I’d mention this in case anyone has anything to add, or to at least post something here “warning” about this behaviour.

slower but probably easier to implement

Can you share some code along with the data where Quad is noticeably slower than Image for you?

Hm, I guess you may have a point - my experience with “laggier” shapes was with patch glyphs (with thousands of them being updated with a slider callback that changes the Most of these patches had a lot more than 4 vertices too. For this particular thing I ended up implementing the quad approach and it’s perfectly fine.