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

Cannot group by variable with marginalkde #515

Open
itsdfish opened this issue Aug 26, 2022 · 0 comments
Open

Cannot group by variable with marginalkde #515

itsdfish opened this issue Aug 26, 2022 · 0 comments

Comments

@itsdfish
Copy link

itsdfish commented Aug 26, 2022

MWE

using DataFrames, StatsPlots
n = 1000
df = DataFrame(condition = rand(1:2, n), x = rand(n), y = rand(n))
@df df marginalkde(:x, :y, group=:condition, layout=2)

Error Message

@df df marginalkde(:x, :y, group=:condition, layout=2)
ERROR: BoundsError: attempt to access 256-element Vector{Float64} at index [[2, 3, 4, 5, 8, 11, 12, 14, 16, 17    982, 985, 986, 987, 992, 993, 994, 995, 999, 1000]]
Stacktrace:
  [1] throw_boundserror(A::Vector{Float64}, I::Tuple{Vector{Int64}})
    @ Base ./abstractarray.jl:691
  [2] checkbounds
    @ ./abstractarray.jl:656 [inlined]
  [3] _getindex
    @ ./multidimensional.jl:838 [inlined]
  [4] getindex
    @ ./abstractarray.jl:1218 [inlined]
  [5] filter_data(v::Vector{Float64}, idxfilter::Vector{Int64})
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/F2mWY/src/group.jl:50
  [6] filter_data!(plotattributes::Dict{Symbol, Any}, idxfilter::Vector{Int64})
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/F2mWY/src/group.jl:55
  [7] _filter_input_data!(plotattributes::Dict{Symbol, Any})
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/F2mWY/src/group.jl:62
  [8] _finish_userrecipe!(plt::Plots.Plot{Plots.GRBackend}, kw_list::Vector{Dict{Symbol, Any}}, recipedata::RecipeData)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/F2mWY/src/user_recipe.jl:104
  [9] _process_userrecipes!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/F2mWY/src/user_recipe.jl:34
 [10] recipe_pipeline!(plt::Any, plotattributes::Any, args::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/F2mWY/src/RecipesPipeline.jl:70
 [11] _plot!(plt::Plots.Plot, plotattributes::Any, args::Any)
    @ Plots ~/.julia/packages/Plots/lW9ll/src/plot.jl:209
 [12] #plot#145
    @ ~/.julia/packages/Plots/lW9ll/src/plot.jl:91 [inlined]
 [13] marginalkde(::Vector{Float64}, ::Vararg{Vector{Float64}}; kw::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:group, :layout), Tuple{Vector{Int64}, Int64}}})
    @ StatsPlots ~/.julia/packages/RecipesBase/qpxEX/src/RecipesBase.jl:364
 [14] add_label(::Vector{String}, ::Function, ::Vector{Float64}, ::Vararg{Vector{Float64}}; kwargs::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:group, :layout), Tuple{Vector{Int64}, Int64}}})
    @ StatsPlots ~/.julia/packages/StatsPlots/8DjQs/src/df.jl:153
 [15] (::var"#175#176")(485::DataFrame)
    @ Main ./none:0
 [16] top-level scope
    @ Untitled-1:5

Version

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

No branches or pull requests

1 participant