How to center-align an Image glyph?

The glyph is produced using image_url. The x,y coordinates specify the location of the NW corner of the image. How to make x,y coordinates specify the center of the image?

Also, how to specify a relative url that would use the http protocol? ‘./foo/bar.png’ defaults to ‘file://…’

ImageURL glyphs supports setting an anchor property:

  http://bokeh.pydata.org/en/latest/docs/reference/models/glyphs.html#bokeh.models.glyphs.ImageURL.anchor

So, if using bokeh.plotting

  renderer = p.image_url(...)
  renderer.glyph.anchor = ...

For relative URLs, AFAIK it matters how you open the HTML file. If you open as a file, the relative link will also be a file, but if you open from a server, the relative link will refer to the server. So, as a suggestion, view the file with some lightweight HTTP server (python has one built in).

Bryan

···

On Apr 12, 2016, at 4:10 AM, Paul A <[email protected]> wrote:

The glyph is produced using image_url. The x,y coordinates specify the location of the NW corner of the image. How to make x,y coordinates specify the center of the image?

Also, how to specify a relative url that would use the http protocol? './foo/bar.png' defaults to 'file://...'

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/35399572-81cb-4d47-980b-0de5e80a66dd%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.