InexactError: trunc(Int64, NaN) while using theme(:mute) in plots

I have the following code

using Plots
gr()
theme(:mute)

x1 =200:0.1:300.0
plot(x1,rand(length(x1)))

which produces the following error

InexactError: trunc(Int64, NaN)

Stacktrace:
 [1] trunc at .\float.jl:703 [inlined]
 [2] round at .\float.jl:367 [inlined]
 [3] (::Colon)(::Float64, ::Float64, ::Float64) at .\twiceprecision.jl:419
 [4] get_minor_ticks(::Plots.Subplot{Plots.GRBackend}, ::Plots.Axis, ::Tuple{Array{Float64,1},Array{String,1}}) at C:\Users\Sarthak\.julia\packages\Plots\cc8wh\src\axes.jl:306
 [5] axis_drawing_info(::Plots.Subplot{Plots.GRBackend}) at C:\Users\Sarthak\.julia\packages\Plots\cc8wh\src\axes.jl:616
 [6] gr_display(::Plots.Subplot{Plots.GRBackend}, ::Measures.Length{:mm,Float64}, ::Measures.Length{:mm,Float64}, ::Array{Float64,1}) at C:\Users\Sarthak\.julia\packages\Plots\cc8wh\src\backends\gr.jl:1331
 [7] gr_display(::Plots.Plot{Plots.GRBackend}, ::String) at C:\Users\Sarthak\.julia\packages\Plots\cc8wh\src\backends\gr.jl:716
 [8] _show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("image/svg+xml")}, ::Plots.Plot{Plots.GRBackend}) at C:\Users\Sarthak\.julia\packages\Plots\cc8wh\src\backends\gr.jl:1922
 [9] show(::Base.GenericIOBuffer{Array{UInt8,1}}, ::MIME{Symbol("image/svg+xml")}, ::Plots.Plot{Plots.GRBackend}) at C:\Users\Sarthak\.julia\packages\Plots\cc8wh\src\output.jl:216
 [10] sprint(::Function, ::MIME{Symbol("image/svg+xml")}, ::Vararg{Any,N} where N; context::Nothing, sizehint::Int64) at .\strings\io.jl:105
 [11] sprint at .\strings\io.jl:101 [inlined]
 [12] _ijulia_display_dict(::Plots.Plot{Plots.GRBackend}) at C:\Users\Sarthak\.julia\packages\Plots\cc8wh\src\ijulia.jl:53
 [13] display_dict(::Plots.Plot{Plots.GRBackend}) at C:\Users\Sarthak\.julia\packages\Plots\cc8wh\src\init.jl:83
 [14] #invokelatest#1 at .\essentials.jl:712 [inlined]
 [15] invokelatest at .\essentials.jl:711 [inlined]
 [16] execute_request(::ZMQ.Socket, ::IJulia.Msg) at C:\Users\Sarthak\.julia\packages\IJulia\yLI42\src\execute_request.jl:112
 [17] #invokelatest#1 at .\essentials.jl:712 [inlined]
 [18] invokelatest at .\essentials.jl:711 [inlined]
 [19] eventloop(::ZMQ.Socket) at C:\Users\Sarthak\.julia\packages\IJulia\yLI42\src\eventloop.jl:8
 [20] (::IJulia.var"#15#18")() at .\task.jl:358

Surprisingly if i change the code to

x1 =200:0.1:298.0
plot(x1,rand(length(x1)))

it does not produce the error and gives back the plot.
I have noticed this only while using theme(:mute) but there was no error in both cases while using theme(:default)

Can anyone explain this?

Can’t reproduce on Julia 1.4.1 on Mac. Are all your packages up to date?

I have updated the “Plots” package from v0.29.9 to v1.2.6. The problem is solved.
Thanks a lot @dpsanders

1 Like