How do I work with images in Bokeh (Python)

You can use the ImageURL glyph (image_url plot method)to load images locally or from the web.

from bokeh.plotting import figure, show, output_file


p = figure(x_range=(0,1), y_range=(0,1))
p.image_url(url=['tree.png'], x=0, y=1, w=0.8, h=0.6)
## could also leave out keywords
# p.image_url(['tree.png'], 0, 1, 0.8, h=0.6)  

Image Example

One gotcha – if you graph only an image (and no other data), you’ll have to explicitly set the plot ranges.

Here’s the docs:

Leave a Comment