Plots export to svg with text converted to shape

I have two julia versions: one julia 1.0 with Plots 0.28.4 and one julia 1.5.1 with Plots 1.6.4. They both use the GR backend. Basically I don’t change anything. Take this little script:

import Plots
using Plots

plot(exp.(0:0.01:4))
savefig("test.svg")		

When I execute it with the julia1.0/Plots 0.28.4 setup I get a SVG where the text is text. When I do the same with Julia 1.5.1 and Plots 1.6.4 I get a SVG with a text in it that is a shape. Due to my further pipeline of doing stuff, I prefer the SVG with text instead of shape.
Do you happen to know if I can get text that is text in SVG with that setup? Also, if you happen to know the background and if that is a GR or a Plots thing, I would love to be enlightened :slight_smile:

I found the answer in some Issue which skipped my first 100 search attempts…
https://github.com/JuliaPlots/Plots.jl/issues/2596#issuecomment-616054537

You should explicitly include a font that is known to GR() like this:

import Plots
using Plots

plot(exp.(0:0.01:4), fontfamily="helvetica"))
savefig("test.svg")

and voila, text is text in your svg.

5 Likes