Adding 45 degree guideline

I’d like to add a guideline to my scatterplot, and I’m having the same issue as described in this post from 2016, plotting 45 degree line in bokeh

The ray described by this glyph does not satisfy the function of y=x:

p.ray([0], [0], length=0, angle=numpy.pi/4)

The last link is 404, so maybe there is a better solution?

FWIW, I believe the last link from that discussion would now be https://github.com/bokeh/bokeh/tree/master/examples/custom/gears

A very simple alternative to ray that respects your data would be a simple line where the outer coordinates are way beyond your data and where DataRage1d ranges are set to ignore this renderer.

If this is for an “infinite” annotation, that is what slope is for:

https://docs.bokeh.org/en/latest/docs/user_guide/annotations.html#slopes

1 Like