Italic string in a plot, how?

Hi, I’m trying to create a plot with Plots: without using Latex, how can one make an italic label for the axes?

One solution is posted here using unicode. Just copy and paste your text from the website linked, to the Plots’ labels inside raw"":

using Plots
scatter(rand(10,10), xlabel=raw"𝑳𝒂𝒃𝒆𝒍 π’Šπ’ π’Šπ’•π’‚π’π’Šπ’„")

That’s quite clever, as a workaround, and works with English and no other(?) (European) languages. Also works for bold and/or italics.

Works for my (Icelandic) name: β€œπ‘ƒπ‘ŽΜπ‘™π‘™ Haraldsson”, but not for e.g. [PΓ‘ll] Þorkellsson, had I been the son of Þorkell. EDIT, maybe I spoke too soon, copying into the REPL, it looks odd, but that may or may not apply to your plotting package (I suppose could depend, e.g. working for web based ones?).

I don’t think you need raw as in raw"𝑳𝒂𝒃𝒆𝒍 π’Šπ’ π’Šπ’•π’‚π’π’Šπ’„"

1 Like

I need it, otherwise my Plots gr() display looks like this:


That’s strange (and curious why is it be needed?), since:

julia> julia> raw"𝑳𝒂𝒃𝒆𝒍 π’Šπ’ π’Šπ’•π’‚π’π’Šπ’„" == "𝑳𝒂𝒃𝒆𝒍 π’Šπ’ π’Šπ’•π’‚π’π’Šπ’„" # also same (String) types.
1 Like

Thanks a lot for the suggestions! I indeed solved my issue.

Honestly, I have no idea… But instead of raw, it would work just as well if we protected the above unicode italic string in parentheses ( )