0

How do I add circle-clipped image glyphs to my chart, without processing and uploading the images manually beforehand? I'm open to using other modules.

I want the end result to look something like this chart (from nytimes).

https://i.stack.imgur.com/xmMYd.jpg

My current understanding is that we can only load images directly from urls, which is not my desired outcome. http://docs.bokeh.org/en/latest/docs/reference/models/glyphs/image_url.html

bigreddot
  • 33,642
  • 5
  • 69
  • 122
siowy
  • 238
  • 1
  • 2
  • 11

1 Answers1

0

My current understanding is that we can only load images directly from urls

This is not correct, there is also ImageRGBA which allows for sending images as raw RGBA data, directly embedded in the Bokeh document. See, e.g., this gallery example:

http://docs.bokeh.org/en/latest/docs/gallery/image_rgba.html

So assuming that images is a Python list of 2D NumPy arrays of RGBA data for the (pre-cropped) images you want to display, then Bokeh could show them with:

p.image_rgba(image=images, x=....)

Of course, you have to convert the images to RGBA arrays yourself, and also crop them, so things may simply be easier or more ready made for this use-case with another tool.

bigreddot
  • 33,642
  • 5
  • 69
  • 122