Raw"\nabla" fails in labels

I am trying to get “nice” labels for a plot and the unicode characters work properly only sometimes:

using Plots

plot(rand(10),label="δ works")                             
plot!(rand(10),label=raw"\delta works")                             
plot!(rand(10),label="∇ works")  
plot!(rand(10),label=raw"\nabla doesn't work")                             

which gives:
image

What’s the difference between \delta and \nabla that makes the label fail?

The \n makes a newline. \d doesn’t have such a special meaning. Normally the raw string should prevent that interpretation, but this looks to be a bug.

2 Likes

Probably some parser issue. Consider using LaTeX notation:

using Plots

plot(rand(10),label="δ works")                             
plot!(rand(10),label=raw"LaTeX $\delta$ works")                             
plot!(rand(10),label="∇ works")  
plot!(rand(10),label=raw"LaTeX $\nabla$ works")

This will give the following:
lol

Edit: seems like we have Plots.jl to blame, because it tries to process escape literals even in a raw string.

2 Likes