0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

juliaでPlot.jl tilte等に英語以外は駄目 BoundsError

Last updated at Posted at 2018-12-10

Julia: ver.1.0.2
GR: ver0.6, ver1.0

GRでtitleや軸ラベルの設定

hoge = [1,2,3]; foo = [1.5,2.5,3.5]
data = [hoge, foo]
labels = ["hoge", "foo"]
using Plots
Plots.gr()
plot(data, 
     xaxis = "x axis",
     yaxis = "y axis",
     label = labels,
     title = "aa")
gr1.png

GR: ver0.6 & ver1.0の場合

title等に日本語やギリシャ文字を使うと,
BoundsErrorを吐く (なんでBoundsError ??)

hoge = [1,2,3]; foo = [1.5,2.5,3.5]
data = [hoge, foo]
labels = ["hoge", "foo"]
using Plots
Plots.gr()
plot(data, 
     xaxis = "x axis",
     yaxis = "y axis",
     label = labels,
     title = "あ")
BoundsError: attempt to access 2-element Array{UInt8,1} at index [3]

Stacktrace:
 [1] setindex!(::Array{UInt8,1}, ::Int64, ::Int64) at ./array.jl:583
 [2] latin1(::String) at /Users/Asahi/.julia/v0.6/GR/src/GR.jl:522
 [3] text at /Users/Asahi/.julia/v0.6/GR/src/GR.jl:554 [inlined]
 [4] gr_text(::Float64, ::Float64, ::String) at /Users/Asahi/.julia/v0.6/Plots/src/backends/gr.jl:214
 [5] gr_display(::Plots.Subplot{Plots.GRBackend}, ::Measures.Length{:mm,Float64}, ::Measures.Length{:mm,Float64}, ::Array{Float64,1}) at /Users/Asahi/.julia/v0.6/Plots/src/backends/gr.jl:943
 [6] gr_display(::Plots.Plot{Plots.GRBackend}, ::String) at /Users/Asahi/.julia/v0.6/Plots/src/backends/gr.jl:583
 [7] _show(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("image/svg+xml")}, ::Plots.Plot{Plots.GRBackend}) at /Users/Asahi/.julia/v0.6/Plots/src/backends/gr.jl:1380
 [8] show(::Base.AbstractIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("image/svg+xml")}, ::Plots.Plot{Plots.GRBackend}) at /Users/Asahi/.julia/v0.6/Plots/src/output.jl:202
 [9] #sprint#228(::Void, ::Function, ::Int64, ::Function, ::MIME{Symbol("image/svg+xml")}, ::Vararg{Any,N} where N) at ./strings/io.jl:66
 [10] display_dict(::Plots.Plot{Plots.GRBackend}) at /Users/Asahi/.julia/v0.6/Plots/src/output.jl:295
 [11] (::Compat.#inner#6{Array{Any,1},IJulia.#display_dict,Tuple{Plots.Plot{Plots.GRBackend}}})() at /Users/Asahi/.julia/v0.6/Compat/src/Compat.jl:189
 [12] execute_request(::ZMQ.Socket, ::IJulia.Msg) at /Users/Asahi/.julia/v0.6/IJulia/src/execute_request.jl:223
 [13] (::Compat.#inner#6{Array{Any,1},IJulia.#execute_request,Tuple{ZMQ.Socket,IJulia.Msg}})() at /Users/Asahi/.julia/v0.6/Compat/src/Compat.jl:189
 [14] eventloop(::ZMQ.Socket) at /Users/Asahi/.julia/v0.6/IJulia/src/eventloop.jl:8
 [15] (::IJulia.##13#16)() at ./task.jl:335
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?