Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] histogram error #4059

Closed
smartinsightsfromdata opened this issue Jan 23, 2022 · 1 comment
Closed

[BUG] histogram error #4059

smartinsightsfromdata opened this issue Jan 23, 2022 · 1 comment
Labels

Comments

@smartinsightsfromdata
Copy link

smartinsightsfromdata commented Jan 23, 2022

Details

Update

I installed Julia 1.6.5 and reinstalled Plots. This seems to work. It may be that the problem is connected with 1.7.1. Unfortunately I'm too new in Julia to go any deeper into the problem.
It would be useful to understand if others have the issue...

===

My code: comes directly from the help (!)

using Plots
histogram([1,2,1,1,4,3,8],bins=0:8)  

I get:

The function body AST defined by this @generated function is not pure. This likely means it contains a closure, a comprehension or a generator.

Stacktrace:
  [1] #_make_hist#236
    @ ~/.julia/packages/Plots/qZHsp/src/recipes.jl:674 [inlined]
  [2] macro expansion
    @ ~/.julia/packages/Plots/qZHsp/src/recipes.jl:685 [inlined]
  [3] apply_recipe(plotattributes::Dict{Symbol, Any}, #unused#::Type{Val{:barhist}}, x::Base.OneTo{Int64}, y::Vector{Float64}, z::Nothing)
    @ Plots ~/.julia/packages/RecipesBase/zBoFG/src/RecipesBase.jl:275
  [4] _process_seriesrecipe(plt::Plots.Plot{Plots.GRBackend}, plotattributes::Dict{Symbol, Any})
    @ Plots ~/.julia/packages/Plots/qZHsp/src/pipeline.jl:408
  [5] _process_seriesrecipe(plt::Plots.Plot{Plots.GRBackend}, plotattributes::Dict{Symbol, Any})
    @ Plots ~/.julia/packages/Plots/qZHsp/src/pipeline.jl:417
  [6] _plot!(plt::Plots.Plot{Plots.GRBackend}, plotattributes::Dict{Symbol, Any}, args::Tuple{Vector{Int64}})
    @ Plots ~/.julia/packages/Plots/qZHsp/src/plot.jl:234
  [7] plot(args::Vector{Int64}; kw::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:bins, :seriestype), Tuple{UnitRange{Int64}, Symbol}}})
    @ Plots ~/.julia/packages/Plots/qZHsp/src/plot.jl:57
  [8] #histogram#411
    @ ~/.julia/packages/RecipesBase/zBoFG/src/RecipesBase.jl:369 [inlined]
  [9] top-level scope
    @ In[9]:1
 [10] eval
    @ ./boot.jl:373 [inlined]
 [11] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:1196

I also tried:

using Plots
x = rand(100)
nbins = 50
histogram(x, bins=nbins)

And here I get:

MethodError: no method matching floatrange(::Type{Float64}, ::Int64, ::Int64, ::Float64, ::Int64)
Closest candidates are:
  floatrange(::Type{T}, ::Integer, ::Integer, ::Integer, ::Integer) where T at ~/packages/julias/julia-1.7/share/julia/base/twiceprecision.jl:370
  floatrange(::AbstractFloat, ::AbstractFloat, ::Real, ::AbstractFloat) at ~/packages/julias/julia-1.7/share/julia/base/twiceprecision.jl:384

Stacktrace:
  [1] floatrange(a::Float64, st::Float64, len::Float64, divisor::Float64)
    @ Base ./twiceprecision.jl:392
  [2] histrange(lo::Float64, hi::Float64, n::Int64, closed::Symbol)
    @ StatsBase ~/.julia/packages/StatsBase/548SN/src/hist.jl:99
  [3] histrange(v::Vector{Float64}, n::Int64, closed::Symbol)
    @ StatsBase ~/.julia/packages/StatsBase/548SN/src/hist.jl:39
  [4] _hist_edge
    @ ~/.julia/packages/Plots/qZHsp/src/recipes.jl:647 [inlined]
  [5] #229
    @ ~/.julia/packages/Plots/qZHsp/src/recipes.jl:655 [inlined]
  [6] map
    @ ./tuple.jl:221 [inlined]
  [7] _hist_edges
    @ ~/.julia/packages/Plots/qZHsp/src/recipes.jl:654 [inlined]
  [8] _make_hist(vs::Tuple{Vector{Float64}}, binning::Int64; normed::Bool, weights::Nothing)
    @ Plots ~/.julia/packages/Plots/qZHsp/src/recipes.jl:669
  [9] macro expansion
    @ ~/.julia/packages/Plots/qZHsp/src/recipes.jl:685 [inlined]
 [10] apply_recipe(plotattributes::Dict{Symbol, Any}, #unused#::Type{Val{:barhist}}, x::Base.OneTo{Int64}, y::Vector{Float64}, z::Nothing)
    @ Plots ~/.julia/packages/RecipesBase/zBoFG/src/RecipesBase.jl:275
 [11] _process_seriesrecipe(plt::Plots.Plot{Plots.GRBackend}, plotattributes::Dict{Symbol, Any})
    @ Plots ~/.julia/packages/Plots/qZHsp/src/pipeline.jl:408
 [12] _process_seriesrecipe(plt::Plots.Plot{Plots.GRBackend}, plotattributes::Dict{Symbol, Any})
    @ Plots ~/.julia/packages/Plots/qZHsp/src/pipeline.jl:417
 [13] _plot!(plt::Plots.Plot{Plots.GRBackend}, plotattributes::Dict{Symbol, Any}, args::Tuple{Vector{Float64}})
    @ Plots ~/.julia/packages/Plots/qZHsp/src/plot.jl:234
 [14] plot(args::Vector{Float64}; kw::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:bins, :seriestype), Tuple{Int64, Symbol}}})
    @ Plots ~/.julia/packages/Plots/qZHsp/src/plot.jl:57
 [15] #histogram#411
    @ ~/.julia/packages/RecipesBase/zBoFG/src/RecipesBase.jl:369 [inlined]
 [16] top-level scope
    @ In[10]:1
 [17] eval
    @ ./boot.jl:373 [inlined]
 [18] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:1196

I get the same with StatsPlots. So far I can have an histogram only with Pyplot if I use it outside of Plots.

Backends

This bug occurs on ( insert x below )

Backend yes no untested
gr (default) X
pyplot x
plotlyjs x
pgfplotsx x
unicodeplots x
inspectdr x
gaston x

Versions

Plots.jl version:Plots v0.28.4
Backend version (]st -m <backend(s)>):PlotlyJS v0.13.1; PlotlyJS v0.13.1; PyPlot v2.10.0
Output of versioninfo():
julia> versioninfo()
Julia Version 1.7.1
Commit ac5cc99908 (2021-12-22 19:35 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)

@smartinsightsfromdata
Copy link
Author

Apologies. I ended up to report this twice by mistake. See #4060

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant