Rays get hidden when zooming too much
See original GitHub issueDescription of the problem
When creating a plot with rays, if I zoom in “too much”, rays disappear. Apparently, this happens when zooming small areas which are relatively far from the start of the rays.
edit Basically, “infinite” rays gets shorter as you zoom in. Zooming in far from the start point will make the ray be too short to be visible.
MWE
Running the following code in jupyter notebook, rays start from 0 and have infinite length upwards. If I , for instance, zoom in the area (0;1), (35,0.5) I can still see the rays being painted, but if zoom in the area (0; 1.01), (35;0.98), rays disappear.
If, after zooming in (0; 1.01), (35;0.98), I pan the view toward the bottom, I can see the rays appearing near y coordinate 0.14. Therefore, rays have an y-extension that goes from 0 to 0.14, instead of 0 to infinity.
Resetting the view will bring back the rays as expected.
x = np.arange(50)
data = np.random.rand(x.shape[0])
tags = [1, 17, 31]
colors = 'red green red'.split()
ax = figure(plot_width=300, plot_height=300)
for t, c in zip(tags, colors):
ax.ray(x=t, y=0, length=0, angle=90, angle_units='deg', color=c)
ax.line(x, data)
show(ax)
No errors on JavaScript console.
Platform
- bokeh 0.13.0
- python 3.6.6
- jupyter notebook 5.6.0
- Fedora Linux 27
- mozilla firefox 61.0.1
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
Anyway, we will have to report to a line clipping algorithm, e.g. Liang-Barsky (possible JS ref implementation here: https://gist.github.com/w8r/7b701519a7c5b4840bec4609ceab3171)
Even more fun,
Number.MAX_SAFE_INTEGER
renders this: