Text/Label not shown when output_backend = 'svg'

Good day,

I have been working with adding labels to my plots for publishing purposes(they ask for .svg quality). However, I see that bokeh doesn’t show any text or label glyphs when the output_backend is set up as “svg”. I didn’t find another related topic through this forum nor google, so hopefully I am not reposting something well known. :zipper_mouth_face:

Here is a minimal code scenario:

z = figure(title="Testing text plotting with svg support",
           x_range=(0, 8), y_range=(0, 8), width=500, height=500)

z.text(x=[2, 4, 6], y=[2, 4, 6], text=['Dos', 'Cuatro', 'Seis'])

#Change to 'canvas' for default backend setting
z.output_backend = 'svg'
show(z)

I could always add these labels manually by inkscape, but I was wondering if there is a workaround?

Have a great weekend,

Martin

@mfjimenez please always specify relevant version information on any support question for an open source project.

Ooops, it’s version 2.4.0.

In that case it’s probably just a bug, so a GitHub Issue with all details would be appropriate (please include the missing imports to make the MRE complete and self-contained).

It was fixed in 2.4.1 (PR Actually fix clipping in SVG `<text>` nodes by mattpap · Pull Request #11644 · bokeh/bokeh · GitHub).

2 Likes

That is fantastic, quite a coincidence that it was recently fixed. :slightly_smiling_face: