Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Plot JULIA绘制GR savefig错误_Plot_Julia - Fatal编程技术网

Plot JULIA绘制GR savefig错误

Plot JULIA绘制GR savefig错误,plot,julia,Plot,Julia,当我第一次使用JUNO在JULIA中运行绘图时,savefig(Path)给出了以下错误。当我第二次运行长模拟时,错误消失了。有什么线索可以解释为什么会这样吗 代码 Characteristic curve gr() Plot1= plot(Se, 10.*log10.(H_vg), label= "Vangenuchten") plot!(Se, 10.*log10.(H_kg), label= "Kosugi")

当我第一次使用JUNO在JULIA中运行绘图时,savefig(Path)给出了以下错误。当我第二次运行长模拟时,错误消失了。有什么线索可以解释为什么会这样吗

代码

Characteristic curve
            gr()
            Plot1= plot(Se, 10.*log10.(H_vg), label= "Vangenuchten")
            plot!(Se, 10.*log10.(H_kg), label= "Kosugi")
            plot!( title= "THETA(h)", xlabel= "Se [-]", ylabel= "log10 h [cm]", linewidth=4)


            # Unsaturated curve
            Plot2= plot(Se, Kr_vg, label= "Vangenuchten")
            plot!(Se, Kr_kg, label= "Kosugi")
            plot!(title= "K(theta)", xlabel= "Se [-]", ylabel= "Kr [-]", linewidth=4)

            #Infiltration
            Infiltration_Inv2= Infiltration_Inv[i_Sample, 1: Infiltration_N[i_Sample]]
            Infiltration2= Infiltration[i_Sample, 1: Infiltration_N[i_Sample]]
            Infiltration_Hydro2 = Infiltration_Hydro[i_Sample, 1: Infiltration_N[i_Sample]]
            T2=  T[i_Sample, 1:Infiltration_N[i_Sample]]
            Plot3= plot(T2, Infiltration2, label= "Observed")
            plot!(T2, Infiltration_Hydro2, label= "Best")
            plot!(T2, Infiltration_Inv2, label= "Simulated")
            plot!(title= "INFILTRATION METHODS", xlabel= "Time [minutes]", ylabel= "Infiltration [mm/minute]", linewidth=4)

            #DθDh
            Plot4= plot(Se, DθDh_kg)
            plot!(title= "Pore Size Distribution", xlabel= "Se", ylabel= "Probality Distribution", linewidth=4)

            plot(Plot1, Plot2, Plot3, Plot4, layout=(4,1))
            savefig(Path)
**LoadError: MethodError: no method matching setcharheight(::Float64)**
*The applicable method may be too new: running in world age 22349, while current world is 22350.*
Closest candidates are:
  setcharheight(::Real) at C:\JULIA\pkgs-0.6.2.1\v0.6\GR\src\GR.jl:1071 (method too new to be called from this world context.)
while loading C:\JOE\Main\MODELS\SOIL\BEST\MAIN_BEST.jl, in expression starting on line 260
#gr_set_font#463(::Symbol, ::Symbol, ::ColorTypes.RGBA{Float64}, ::Int64, ::Function, ::Plots.Font) at gr.jl:412
(::Plots.#kw##gr_set_font)(::Array{Any,1}, ::Plots.#gr_set_font, ::Plots.Font) at <missing>:0
gr_set_xticks_font(::Plots.Subplot{Plots.GRBackend}) at gr.jl:605
_update_min_padding!(::Plots.Subplot{Plots.GRBackend}) at gr.jl:654
_collect(::Array{RecipesBase.AbstractLayout,2}, ::Base.Generator{Array{RecipesBase.AbstractLayout,2},Plots.#_update_min_padding!}, ::Base.EltypeUnknown, ::Base.HasShape) at array.jl:488
_update_min_padding!(::Plots.GridLayout) at layouts.jl:310
_collect(::Array{RecipesBase.AbstractLayout,2}, ::Base.Generator{Array{RecipesBase.AbstractLayout,2},Plots.#_update_min_padding!}, ::Base.EltypeUnknown, ::Base.HasShape) at array.jl:488
_update_min_padding!(::Plots.GridLayout) at layouts.jl:310
prepare_output(::Plots.Plot{Plots.GRBackend}) at plot.jl:262
show(::IOStream, ::MIME{Symbol("application/pdf")}, ::Plots.Plot{Plots.GRBackend}) at output.jl:209
pdf(::Plots.Plot{Plots.GRBackend}, ::String) at output.jl:25
savefig(::Plots.Plot{Plots.GRBackend}, ::String) at output.jl:123
BEST_MAIN() at MAIN_BEST.jl:252
include_string(::String, ::String) at loading.jl:522
include_string(::Module, ::String, ::String) at Compat.jl:174
(::Atom.##57#60{String,String})() at eval.jl:74
withpath(::Atom.##57#60{String,String}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
macro expansion at eval.jl:72 [inlined]
(::Atom.##56#59{Dict{String,Any}})() at task.jl:80
错误消息

Characteristic curve
            gr()
            Plot1= plot(Se, 10.*log10.(H_vg), label= "Vangenuchten")
            plot!(Se, 10.*log10.(H_kg), label= "Kosugi")
            plot!( title= "THETA(h)", xlabel= "Se [-]", ylabel= "log10 h [cm]", linewidth=4)


            # Unsaturated curve
            Plot2= plot(Se, Kr_vg, label= "Vangenuchten")
            plot!(Se, Kr_kg, label= "Kosugi")
            plot!(title= "K(theta)", xlabel= "Se [-]", ylabel= "Kr [-]", linewidth=4)

            #Infiltration
            Infiltration_Inv2= Infiltration_Inv[i_Sample, 1: Infiltration_N[i_Sample]]
            Infiltration2= Infiltration[i_Sample, 1: Infiltration_N[i_Sample]]
            Infiltration_Hydro2 = Infiltration_Hydro[i_Sample, 1: Infiltration_N[i_Sample]]
            T2=  T[i_Sample, 1:Infiltration_N[i_Sample]]
            Plot3= plot(T2, Infiltration2, label= "Observed")
            plot!(T2, Infiltration_Hydro2, label= "Best")
            plot!(T2, Infiltration_Inv2, label= "Simulated")
            plot!(title= "INFILTRATION METHODS", xlabel= "Time [minutes]", ylabel= "Infiltration [mm/minute]", linewidth=4)

            #DθDh
            Plot4= plot(Se, DθDh_kg)
            plot!(title= "Pore Size Distribution", xlabel= "Se", ylabel= "Probality Distribution", linewidth=4)

            plot(Plot1, Plot2, Plot3, Plot4, layout=(4,1))
            savefig(Path)
**LoadError: MethodError: no method matching setcharheight(::Float64)**
*The applicable method may be too new: running in world age 22349, while current world is 22350.*
Closest candidates are:
  setcharheight(::Real) at C:\JULIA\pkgs-0.6.2.1\v0.6\GR\src\GR.jl:1071 (method too new to be called from this world context.)
while loading C:\JOE\Main\MODELS\SOIL\BEST\MAIN_BEST.jl, in expression starting on line 260
#gr_set_font#463(::Symbol, ::Symbol, ::ColorTypes.RGBA{Float64}, ::Int64, ::Function, ::Plots.Font) at gr.jl:412
(::Plots.#kw##gr_set_font)(::Array{Any,1}, ::Plots.#gr_set_font, ::Plots.Font) at <missing>:0
gr_set_xticks_font(::Plots.Subplot{Plots.GRBackend}) at gr.jl:605
_update_min_padding!(::Plots.Subplot{Plots.GRBackend}) at gr.jl:654
_collect(::Array{RecipesBase.AbstractLayout,2}, ::Base.Generator{Array{RecipesBase.AbstractLayout,2},Plots.#_update_min_padding!}, ::Base.EltypeUnknown, ::Base.HasShape) at array.jl:488
_update_min_padding!(::Plots.GridLayout) at layouts.jl:310
_collect(::Array{RecipesBase.AbstractLayout,2}, ::Base.Generator{Array{RecipesBase.AbstractLayout,2},Plots.#_update_min_padding!}, ::Base.EltypeUnknown, ::Base.HasShape) at array.jl:488
_update_min_padding!(::Plots.GridLayout) at layouts.jl:310
prepare_output(::Plots.Plot{Plots.GRBackend}) at plot.jl:262
show(::IOStream, ::MIME{Symbol("application/pdf")}, ::Plots.Plot{Plots.GRBackend}) at output.jl:209
pdf(::Plots.Plot{Plots.GRBackend}, ::String) at output.jl:25
savefig(::Plots.Plot{Plots.GRBackend}, ::String) at output.jl:123
BEST_MAIN() at MAIN_BEST.jl:252
include_string(::String, ::String) at loading.jl:522
include_string(::Module, ::String, ::String) at Compat.jl:174
(::Atom.##57#60{String,String})() at eval.jl:74
withpath(::Atom.##57#60{String,String}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
macro expansion at eval.jl:72 [inlined]
(::Atom.##56#59{Dict{String,Any}})() at task.jl:80
**LoadError:MethodError:没有与setcharheight(::Float64)匹配的方法**
*适用的方法可能太新了:运行在世界年龄22349,而当前世界是22350*
最接近的候选人是:
setcharheight(::Real)位于C:\JULIA\pkgs-0.6.2.1\v0.6\GR\src\GR.jl:1071(方法太新,无法从这个世界上下文调用。)
在从第260行开始的表达式中加载C:\JOE\Main\MODELS\SOIL\BEST\Main\u BEST.jl时
#gr_set_font#463(::Symbol,::Symbol,::ColorTypes.RGBA{Float64},::Int64,::Function,::Plots.font)位于gr.jl:412
(::Plots.#kw##gr#u set_font)(::数组{Any,1},::Plots.#gr#u set_font,::Plots.font)位于:0
gr.jl:605处的gr_set_xticks_字体(::Plots.Subplot{Plots.GRBackend})
_更新_min_padding!(::Plots.Subplot{Plots.GRBackend})位于gr.jl:654
_收集(::Array{RecipesBase.AbstractLayout,2},::Base.Generator{Array{RecipesBase.AbstractLayout,2},Plots.#更新_min_padding!},::Base.EltypeUnknown,::Base.hashape)在Array.jl:488
_更新_min_padding!(::Plots.GridLayout)在layouts.jl:310
_收集(::Array{RecipesBase.AbstractLayout,2},::Base.Generator{Array{RecipesBase.AbstractLayout,2},Plots.#更新_min_padding!},::Base.EltypeUnknown,::Base.hashape)在Array.jl:488
_更新_min_padding!(::Plots.GridLayout)在layouts.jl:310
在Plot.jl:262处准备_输出(::Plots.Plot{Plots.GRBackend})
在output.jl:209处显示(::IOStream,::MIME{Symbol(“application/pdf”)},::Plots.Plot{Plots.GRBackend})
输出处的pdf(::Plots.Plot{Plots.GRBackend},::字符串)。jl:25
savefig(::Plots.Plot{Plots.GRBackend},::String)在output.jl:123
BEST_MAIN()在MAIN_BEST.jl:252
加载时包含字符串(::字符串,::字符串)。jl:522
在Compat.jl:174中包含_字符串(::模块,::字符串,::字符串)
(::Atom.##57#60{String,String})在eval.jl:74
在utils.jl:30中使用路径(::Atom.#57#60{String,String},::String)
在eval.jl:38处使用路径(::函数,::字符串)
评估时的宏扩展jl:72[内联]
(::Atom.##56#59{Dict{String,Any}}})在task.jl:80

据我所知,GR后端存在一个bug,其根与绘图代码中的“@eval import#backend”相关,如前所述。
现在的解决方法是在对Plots模块使用命令后,使用一个额外的行导入后端(在您的案例中是GR),类似于下面的代码:

使用绘图
导入GR
#您的代码在此