Hi all,
I’ve found a weird error in my Bokeh 0.12.4 installation using image plots with a user provided ColumnDataSource. When I try to use a custom name for the image data parameter different than ‘image’ I get the following Javascript error in the browser:
Uncaught TypeError: Failed to execute ‘getImageData’ on ‘CanvasRenderingContext2D’: The provided double value is non-finite.
at e.r.ImageView.e._set_data (bokeh-0.12.4.min.js:13)
at e.r.GlyphView.e.set_data (bokeh-0.12.4.min.js:13)
at e.r.GlyphRendererView.e.set_data (bokeh-0.12.4.min.js:19)
at e.r.GlyphRendererView.e.initialize (bokeh-0.12.4.min.js:19)
at e.r.View (bokeh-0.12.4.min.js:4)
at e [as constructor] (bokeh-0.12.4.min.js:4)
at e [as constructor] (bokeh-0.12.4.min.js:19)
at new e (bokeh-0.12.4.min.js:19)
at Object.r.build_views (bokeh-0.12.4.min.js:4)
at e.r.PlotCanvasView.e.build_levels (bokeh-0.12.4.min.js:18)
``
I can reproduce the error easily even with the most simple image plot. For example this slightly modified version of the image sample from the official Bokeh gallery:
import numpy as np
from bokeh.plotting import figure, show, output_file
from bokeh.models import ColumnDataSource
N = 500
x = np.linspace(0, 10, N)
y = np.linspace(0, 10, N)
xx, yy = np.meshgrid(x, y)
d = np.sin(xx)*np.cos(yy)
p = figure(x_range=(0, 10), y_range=(0, 10))
must give a vector of image data for image parameter
source = ColumnDataSource({‘myimage’: [d]})
p.image(‘myimage’, x=0, y=0, dw=10, dh=10, palette=“Spectral11”, source=source)
output_file(“image.html”, title=“image.py example”)
show(p) # open a browser
``
Running exactly the same source code using ‘image’ as the datasource column name works perfectly. I’m running Bokeh on Mac and I didn’t have this error using Bokeh 0.12.3. I’ve tested on two different Mac machines and both exhibit the same behaviour.
Has anyone else found the same error or am I doing some wrong? Does anybody know what could be the cause?
Thank you in advance.
Enrique G. Paredes