【问题标题】:UndefVarError: histogram not defined in JuliaUndefVarError:Julia 中未定义直方图
【发布时间】:2021-11-30 06:24:41
【问题描述】:

我正在尝试如下绘制直方图:

using Plots; using PyPlot
pyplot() # Plots.PyPlotBackend()
x = 0:100;
result = rand(x,2000);
histogram(result)

但是,它返回 UndefVarError

UndefVarError: histogram not defined

Stacktrace:
 [1] top-level scope
   @ In[156]:5
 [2] eval
   @ .\boot.jl:360 [inlined]
 [3] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
   @ Base .\loading.jl:1116

我关注了Plotting a histogram in Julia,但返回错误。

我该如何解决这个错误?

【问题讨论】:

    标签: julia histogram


    【解决方案1】:

    我无法在 Julia 1.6.3 中重现此错误。当我跑步时:

    julia> using Plots; using PyPlot
    
    julia> pyplot() # Plots.PyPlotBackend()
    Plots.PyPlotBackend()
    
    julia> x = 0:100;
    
    julia> result = rand(x,2000);
    
    julia> histogram(result)
    
    

    我明白了:

    没有任何错误。这也适用于我而不运行using PyPlot

    【讨论】:

    • 也适用于我(我使用 1.6.*)。我一直使用直方图。
    猜你喜欢
    • 2015-03-16
    • 2021-08-02
    • 2022-01-20
    • 2020-04-15
    • 1970-01-01
    • 1970-01-01
    • 2012-01-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多