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 bokeh/examples/custom/gears at branch-3.0 · bokeh/bokeh · GitHub

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:

Adding annotations — Bokeh 2.4.2 Documentation

1 Like