It can be done with a bit of fiddling and some custom JS - see below. Hope the code comments are clear enough to explain the approach.

Marcus.

import numpy as np

from bokeh.charts import output_file

from bokeh.models import HoverTool

from bokeh.plotting import figure, show

from bokeh.models import ColumnDataSource

from bokeh.models.callbacks import CustomJS

x, y = np.arange(10), np.arange(10)

arr1 = np.sqrt(x ** 2 + y[:, np.newaxis] ** 2)

# Set up the ColumnDataSource. All variables captured as lists so they have the same length (as required by ColumnDataSource)

# xp,yp and zp are the variables for the HoverTool readout (initialised to 0)

datasrc = ColumnDataSource(data={‘x’:,‘y’:[y],‘z’:[arr1],‘xp’:[0],‘yp’:[0],‘zp’:[0]})

# The JS code finds the indices from the cursor geometry and stores the values needed in xp,yp and zp.

jsCode = ‘’’

var geom = cb_data[‘geometry’];

var data = datasrc.get(‘data’);

var hx = geom.x;

var hy = geom.y;

var x = data[‘x’][0];

var y = data[‘y’][0];

var z = data[‘z’][0];

var dx = x[1] - x[0]

var dy = y[1] - y[0]

var xind = Math.floor((hx + dx/2 - x[0])/dx)

var yind = Math.floor((hy + dy/2 - y[0])/dy)

if ((xind < x.length) && (yind < y.length)) {

data[‘xp’] = [x[xind]];

data[‘yp’] = [y[yind]];

data[‘zp’] = [z[xind][yind]];

datasrc.set(‘data’,data)

datasrc.trigger(‘change’)

}

‘’’

cJS = CustomJS(args = {‘datasrc’:datasrc},code = jsCode)

dx,dy = x[1]-x[0],y[1]-y[0]

p = figure(x_range=(x[0],x[-1]),y_range=(y[0],y[-1]))

# Image linked to ColumnDataSource. Set up so that rectangles centered at corresponding axes values (i.e. using dx and dy…)

i = p.image(‘z’,source=datasrc,x=x[0]-dx/2,y=y[0]-dy/2,dw=x[-1]-x[0]+dx,dh=y[-1]-y[0]+dy,palette=“Spectral11”)

# Create a transparent rectangle which covers the image, linked to the same ColumnDataSource

r = p.rect(source=datasrc,x=(x[0]+x[-1])/2,y=(y[0]+y[-1])/2,width=x[-1]-x[0]+dx,height=y[-1]-y[0]+dy,fill_alpha=0,line_alpha=0)

# Now the ColumnDataSource data dictionary can be accessed for the HoverTool readout

hover = HoverTool(tooltips=[(‘x,y,z:’,’@xp{0},@yp{0},@zp{0.00}’)],callback = cJS)

p.add_tools(hover)

output_file(‘heatmap.html’)

show§

## ···

On Friday, December 2, 2016 at 11:38:20 PM UTC, Elias F. wrote:

Ah-ha - I missed it. Thanks for pointing it out.

Any advice on path forward, i.e. starting from a 2D array like the one the gets generated in my example?

Thanks so much for your quick reply!

E

On Friday, December 2, 2016 at 3:00:42 PM UTC-8, Sarah Bird wrote:

```
The warning is still
```

there