Plots画图,有中文时报错


#1

pie([“我”,“你”],[1,2])
报错如下:
BoundsError: attempt to access 2-element Array{UInt8,1} at index [3]

Stacktrace:
[1] setindex! at .\array.jl:769 [inlined]
[2] latin1(::String) at C:\Users\10244513.julia\packages\GR\k8wwU\src\GR.jl:513
[3] gr_text(::Float64, ::Float64, ::String) at C:\Users\10244513.julia\packages\Plots\rmogG\src\backends\gr.jl:0
[4] gr_display(::Plots.Subplot{Plots.GRBackend}, ::Measures.Length{:mm,Float64}, ::Measures.Length{:mm,Float64}, ::Array{Float64,1}) at C:\Users\10244513.julia\packages\Plots\rmogG\src\backends\gr.jl:1129
[5] gr_display(::Plots.Plot{Plots.GRBackend}, ::String) at C:\Users\10244513.julia\packages\Plots\rmogG\src\backends\gr.jl:526
[6] _show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MIME{Symbol(“image/svg+xml”)}, ::Plots.Plot{Plots.GRBackend}) at C:\Users\10244513.julia\packages\Plots\rmogG\src\backends\gr.jl:1358
[7] show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MIME{Symbol(“image/svg+xml”)}, ::Plots.Plot{Plots.GRBackend}) at C:\Users\10244513.julia\packages\Plots\rmogG\src\output.jl:201
[8] #sprint#325(::Nothing, ::Int64, ::Function, ::Function, ::MIME{Symbol(“image/svg+xml”)}, ::Vararg{Any,N} where N) at .\strings\io.jl:101
[9] sprint(::Function, ::MIME{Symbol(“image/svg+xml”)}, ::Vararg{Any,N} where N) at .\strings\io.jl:97
[10] display_dict(::Plots.Plot{Plots.GRBackend}) at C:\Users\10244513.julia\packages\Plots\rmogG\src\init.jl:73
[11] #invokelatest#1 at .\essentials.jl:686 [inlined]
[12] invokelatest at .\essentials.jl:685 [inlined]
[13] execute_request(::ZMQ.Socket, ::IJulia.Msg) at C:\Users\10244513.julia\packages\IJulia\0cLgR\src\execute_request.jl:256
[14] #invokelatest#1 at .\essentials.jl:686 [inlined]
[15] invokelatest at .\essentials.jl:685 [inlined]
[16] eventloop(::ZMQ.Socket) at C:\Users\10244513.julia\packages\IJulia\0cLgR\src\eventloop.jl:8
[17] (::getfield(IJulia, Symbol("##12#15")))() at .\task.jl:259


#2

似乎是个bug

目前只支持latin1

原始的代码里s = zeros(UInt8, length(string) * 2 这个地方数组越界了


#3

谢谢!已经换Gadfly.jl包了 这个可以用中文