Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG backend not correctly coloring glyphs in legends #6775

Closed
varchasgopalaswamy opened this issue Aug 16, 2017 · 5 comments · Fixed by #10402
Closed

SVG backend not correctly coloring glyphs in legends #6775

varchasgopalaswamy opened this issue Aug 16, 2017 · 5 comments · Fixed by #10402

Comments

@varchasgopalaswamy
Copy link

varchasgopalaswamy commented Aug 16, 2017

In bokeh 0.12.6, trying to use the svg backend with a legend of multiple glyph colors sets all the glyphs to use the color of the last glyph loaded into the legend. What should happen is that I should see a red diamond and blue square, but instead when using the svg backend, you see a blue diamond and square in the legend.

import bokeh.plotting as bp
import bokeh.models as bm
fig = bp.figure(output_backend='svg')
cross = fig.diamond(x=1,y=1,color='red')
square = fig.square(x=2,y=1)
legends = [['circle',[cross]],['square',[square]]]
legend = bm.Legend(items=legends)
fig.add_layout(legend,'left')
bp.show(fig)

gives
image

whereas

import bokeh.plotting as bp
import bokeh.models as bm
fig = bp.figure(output_backend='canvas')
cross = fig.diamond(x=1,y=1,color='red')
square = fig.square(x=2,y=1)
legends = [['circle',[cross]],['square',[square]]]
legend = bm.Legend(items=legends)
fig.add_layout(legend,'left')
bp.show(fig)

gives
image

as expected. I'm running this in a jupyter notebook, with python3.5.2, installed using conda4.3.24 on Firefox on RHEL7

@bryevdv
Copy link
Member

bryevdv commented Aug 16, 2017

Thanks for the detailed report @varchasgopalaswamy there's nothing we can do about it in time for the next release but I have slated it to be looked at for 0.12.8

cc @canavandl

@varchasgopalaswamy
Copy link
Author

varchasgopalaswamy commented Aug 16, 2017

Another, probably related bug - if you use the circle_xor circle_cross glyphs, the cross or x will render, but the surrounding marker will not when using the svg backend.

@bryevdv
Copy link
Member

bryevdv commented Aug 16, 2017

That sounds like it is probably related, and possibly points to an issue in the underlying third-partycanvas2svg library that is used to implement this feature, which to be honest, would not the best scenario to have try and deal with. But we will take a look after the next release is out.

@varchasgopalaswamy
Copy link
Author

Also, trying to hide markers usinglegend.click_policy=hide behaves as expected on the plot, but acts rather strangely for the legend.

Both on:
image

Red Square hidden:
image

Blue Square hidden:
image

Both squares hidden:
image

@bryevdv
Copy link
Member

bryevdv commented Aug 16, 2017

Also, trying to hide markers usinglegend.click_policy=hide behaves as expected on the plot, but acts rather strangely for the legend.

Although we probably need to make this clearer, the SVG output mode is really intended to support the generation of static image exports. That it "works" somewhat in the interactive case is purely an accident, and making it actually work comparable to standard HTML canvas for interactive use in real browsers is not a priority.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants