Closed ivaquero closed 3 years ago
Hi, I am learning AlgebraOfGraphics and trying to reproduce some figures of the book ISLR. Today, I came across some problem and got an error
LoadError: MethodError: no method matching select(::DataFrames.DataFrameColumns{DataFrame}, ::RGB{FixedPointNumbers.N0f8}) [0mClosest candidates are: [0m select(::Any, [91m::AlgebraOfGraphics.DimsSelector[39m) at /Users/integrator/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/select.jl:13 [0m select(::Any, [91m::Union{AbstractString, Symbol}[39m) at /Users/integrator/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/select.jl:15 [0m select(::Any, [91m::Integer[39m) at /Users/integrator/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/select.jl:20 [0m ... MethodError: no method matching select(::DataFrames.DataFrameColumns{DataFrame}, ::RGB{FixedPointNumbers.N0f8}) Closest candidates are: select(::Any, ::AlgebraOfGraphics.DimsSelector) at /Users/integrator/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/select.jl:13 select(::Any, ::Union{AbstractString, Symbol}) at /Users/integrator/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/select.jl:15 select(::Any, ::Integer) at /Users/integrator/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/select.jl:20 ... Stacktrace: [1] (::AlgebraOfGraphics.var"#133#136"{DataFrames.DataFrameColumns{DataFrame}})(s::RGB{FixedPointNumbers.N0f8}) @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/processing.jl:88 [2] iterate @ ./generator.jl:47 [inlined] [3] _collect @ ./array.jl:691 [inlined] [4] collect_similar(cont::Array{RGB{FixedPointNumbers.N0f8}, 0}, itr::Base.Generator{Array{RGB{FixedPointNumbers.N0f8}, 0}, AlgebraOfGraphics.var"#133#136"{DataFrames.DataFrameColumns{DataFrame}}}) @ Base ./array.jl:606 [5] map(f::Function, A::Array{RGB{FixedPointNumbers.N0f8}, 0}) @ Base ./abstractarray.jl:2294 [6] getlabeledarray(layer::AlgebraOfGraphics.Layer, s::RGB{FixedPointNumbers.N0f8}) @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/processing.jl:87 [7] (::AlgebraOfGraphics.var"#138#140"{NamedTuple{(:color,), Tuple{RGB{FixedPointNumbers.N0f8}}}, AlgebraOfGraphics.Layer, Dict{Union{Int64, Symbol}, Any}})(key::Symbol) @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/processing.jl:100 [8] map @ ./tuple.jl:213 [inlined] [9] mapkeys(f::Function, #unused#::NamedTuple{(:color,), Tuple{RGB{FixedPointNumbers.N0f8}}}) @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/LGGSX/src/entries.jl:79 [10] (::AlgebraOfGraphics.var"#137#139"{AlgebraOfGraphics.Layer, Dict{Union{Int64, Symbol}, Any}})(tup::NamedTuple{(:color,), Tuple{RGB{FixedPointNumbers.N0f8}}}) @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/processing.jl:99 [11] map @ ./tuple.jl:214 [inlined] [12] process_mappings(layer::AlgebraOfGraphics.Layer) @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/processing.jl:98 [13] to_entry(layer::AlgebraOfGraphics.Layer) @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/processing.jl:115 [14] process(layer::AlgebraOfGraphics.Layer) @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/processing.jl:122 [15] iterate @ ./generator.jl:47 [inlined] [16] collect(itr::Base.Generator{AlgebraOfGraphics.Layers, typeof(AlgebraOfGraphics.process)}) @ Base ./array.jl:678 [17] map @ ./abstractarray.jl:2323 [inlined] [18] compute_axes_grid(fig::GridPosition, s::AlgebraOfGraphics.Layers; axis::NamedTuple{(), Tuple{}}, palettes::NamedTuple{(), Tuple{}}) @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/layers.jl:71 [19] plot!(fig::GridPosition, s::AlgebraOfGraphics.Layers; axis::NamedTuple{(), Tuple{}}, palettes::NamedTuple{(), Tuple{}}) @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/layers.jl:150 [20] draw!(fig::GridPosition, s::AlgebraOfGraphics.Layers; axis::NamedTuple{(), Tuple{}}, palettes::NamedTuple{(), Tuple{}}) @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/layers.jl:191 [21] draw!(fig::GridPosition, s::AlgebraOfGraphics.Layers) @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/LGGSX/src/algebra/layers.jl:191 [22] top-level scope @ In[31]:9 [23] eval @ ./boot.jl:360 [inlined] [24] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String) @ Base ./loading.jl:1116
This code is as follows, I guess I made some mistake, but I don't know what it is. So, please help, thanks in advance.
using CSV, DataFrames using AlgebraOfGraphics, Colors using CairoMakie using HTTP adsdf = CSV.File(HTTP.get("https://raw.githubusercontent.com/gitony0101/X4DS/main/data/Advertising.csv").body); adsdf = DataFrame(adsdf); layers = linear() + visual(Scatter) p1 = data(adsdf) * mapping(:TV, :sales, color=colorant"red") * layers; p2 = data(adsdf) * mapping(:radio, :sales, color=colorant"red") * layers; p3 = data(adsdf) * mapping(:newspaper, :sales, color=colorant"red") * layers; fig = Figure() ax1 = draw!(fig[1, 1], p1) ax2 = draw!(fig[1, 2], p2) ax3 = draw!(fig[1, 3], p3) fig
I know the cause..
Hi, I am learning AlgebraOfGraphics and trying to reproduce some figures of the book ISLR. Today, I came across some problem and got an error
This code is as follows, I guess I made some mistake, but I don't know what it is. So, please help, thanks in advance.