Plots is Latin1 by default with the GR backend at least, due in part to limitations of the backend:
opened 04:34PM - 28 May 19 UTC
enhancement
Sorry for yet another question. My parameter names contain Greek letters, e.g. <… img src="https://latex.codecogs.com/svg.latex?\Large&space;\alpha" /> or <img src="https://latex.codecogs.com/svg.latex?\Large&space;\rho_A" />. In standard Julia plots, I can pass a [LaTeXString](https://github.com/stevengj/LaTeXStrings.jl) for labelling. Is this also possible here or would I have to write my own plotting code for the chains? Or do you recommend a different approach?
Even if a backend supports Unicode strings, its text rendering may not be capable of displaying many characters (due to limited font coverage, lack of support for combining characters, lack of support for fallback fonts for missing glyphs…). See here for a summary:
opened 03:56PM - 01 May 17 UTC
closed 05:31PM - 20 Aug 20 UTC
bug
GR
```julia
using Plots; gr()
plot(x->x, xlabel="λ")
```
>BoundsError: attempt … to access 1-element Array{UInt8,1} at index [2]
> in setindex!(::Array{UInt8,1}, ::Int64, ::Int64) at ./array.jl:415
in latin1(::String) at /home/juliohm/.julia/v0.5/GR/src/GR.jl:456
in text at /home/juliohm/.julia/v0.5/GR/src/GR.jl:488 [inlined]
in gr_text(::Float64, ::Float64, ::String) at /home/juliohm/.julia/v0.5/Plots/src/backends/gr.jl:191
in gr_display(::Plots.Subplot{Plots.GRBackend}, ::Measures.Length{:mm,Float64}, ::Measures.Length{:mm,Float64}, ::Array{Float64,1}) at /home/juliohm/.julia/v0.5/Plots/src/backends/gr.jl:711
in gr_display(::Plots.Plot{Plots.GRBackend}) at /home/juliohm/.julia/v0.5/Plots/src/backends/gr.jl:494
in _show(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("image/svg+xml")}, ::Plots.Plot{Plots.GRBackend}) at /home/juliohm/.julia/v0.5/Plots/src/backends/gr.jl:1089
in show(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("image/svg+xml")}, ::Plots.Plot{Plots.GRBackend}) at /home/juliohm/.julia/v0.5/Plots/src/output.jl:197
in show(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("text/html")}, ::Plots.Plot{Plots.GRBackend}) at /home/juliohm/.julia/v0.5/Plots/src/output.jl:177
in show(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::String, ::Plots.Plot{Plots.GRBackend}) at ./multimedia.jl:33
in #sprint#304(::Void, ::Function, ::Int64, ::Function, ::String, ::Vararg{Any,N}) at ./strings/io.jl:37
in display_dict(::Plots.Plot{Plots.GRBackend}) at /home/juliohm/.julia/v0.5/Plots/src/output.jl:266
in execute_request(::ZMQ.Socket, ::IJulia.Msg) at /home/juliohm/.julia/v0.5/IJulia/src/execute_request.jl:187
in eventloop(::ZMQ.Socket) at /home/juliohm/.julia/v0.5/IJulia/src/eventloop.jl:8
in (::IJulia.##13#19)() at ./task.jl:360
The solution is for backends to switch to a modern full-featured text renderer. As explained in the issue above, HarfBuzz seems to be a promising cross-platform option.
1 Like