1

I want to use local images as the markers on a figure rather than the provided shapes. Like this image source So instead of:

slider_renderer = plt.square(x='x_mercator', y='y_mercator', source=payload_at_timestamp, size=20, color='lightskyblue')

Something like:

slider_renderer = plt.image(image='path/to/image', x='x_mercator', y='y_mercator', source=payload_at_timestamp, size=20, color='lightskyblue')

I've tried a few ways of doing this without success. In particular, using the Bokeh image object didn't work as intended, with the interpreter complaining that the image was not part of the source dataframe:

quad_icon = skimage.io.imread('analysis_icons/quad.png')
slider_renderer = Image(image=[quad_icon], x='x_mercator', y='y_mercator', source=payload_at_timestamp)

I'm currently outputting the resulting figure in an HTML file, so hosting it locally with bokeh serve isn't a good option.

brigand
  • 11
  • 1
  • `image` is for taking 2d scalar arrays (i.e. arrays of numbers) and colormapping them. Your best bet would be to convert the images to 2d RGBA numpy arrays, and use `image_rgba` instead. There is no built-in facility for displaying image files directly (except via URLs with `image_url`) – bigreddot Mar 03 '22 at 01:58
  • Thanks, let me give this a try. – brigand Mar 03 '22 at 20:16

0 Answers0