I still didn’t find a practical way to type special characters in to a plot legend. In particular, I am trying to type an Angstrom (Å) character in an axis label.
The situation is the following:
In the REPL I can use the unicode substitution and type \AA or \Angstrom, which is replaced by the symbol, and appears correctly in the GR plot, and I can save the figure nicely to PNG or PDF.
This solution appeared to be fine, except that I cannot find a way to do the same thing in a script. The code:
using Plots
plot(xlabel="\\AA")
savefig("test.png")
returns \AA: undefined symbol
If that option worked I think it would be the optimal solution.
I read some threads and it was suggested to use LaTeXStrings. However, I cannot get an acceptable result with it either, and this might be because of the poor documentation of the package, or perhaps I am missing something obvious. In particular, I try:
plot(xlabel=L"\AA")
but that gives me the Angstrom sign in LaTeX equation mode (italics), which is not what I need. I tried
plot(xlabel=L"\textrm{\AA}")
this works, but the font of the Angstrom sign is different from the fonts of the other text of the plot. I could not find a solution to obtain the same fonts when using the latex strings package.
In other words, I still cannot find a way to produce a publication quality plot with Plots with special characters. The use of the LaTeX code seems to be the most general solution, but in this case a practical way to adjust the fonts of the plot to the fonts is needed. As a simple alternative workaround for simple characters, it would be nice if the unicode mapping worked with scripts as it works in the REPL.
I appreciate any help.