I was giving Gadfly a shot, plotting some simple data to see how it works. Most of what I tried works fine and the Package seems amazing. However, I tried testing its boxplot functionality and ran into this issue.
p = plot(x=["Label"], y=randn(10), Geom.boxplot)
So, a similar syntax works fine with other Geom
options. But for boxplot I get the following error:
Error showing value of type Plot:
ERROR: BoundsError: attempt to access 10-element Array{Float64,1} at index [Base.LogicalIndex(Bool[1])]
Stacktrace:
[1] throw_boundserror(::Array{Float64,1}, ::Tuple{Base.LogicalIndex{Int64,BitArray{1}}}) at ./abstractarray.jl:538
[2] checkbounds at ./abstractarray.jl:503 [inlined]
[3] _getindex at ./multidimensional.jl:669 [inlined]
[4] getindex(::Array{Float64,1}, ::BitArray{1}) at ./abstractarray.jl:981
[5] (::Gadfly.Stat.var"#19#23"{Gadfly.Aesthetics})(::Tuple{Nothing,Int64}) at ./none:0
[6] iterate at ./generator.jl:47 [inlined]
[7] Dict{Tuple{Nothing,Int64},Array{Float64,1}}(::Base.Generator{Array{Tuple{Nothing,Int64},1},Gadfly.Stat.var"#19#23"{Gadfly.Aesthetics}}) at ./dict.jl:102
[8] apply_statistic(::Gadfly.Stat.BoxplotStatistic, ::Dict{Symbol,Gadfly.ScaleElement}, ::Gadfly.Coord.Cartesian, ::Gadfly.Aesthetics) at /home/andrew/.julia/packages/Gadfly/cqMtH/src/statistics.jl:1042
[9] apply_statistics(::Array{Gadfly.StatisticElement,1}, ::Dict{Symbol,Gadfly.ScaleElement}, ::Gadfly.Coord.Cartesian, ::Gadfly.Aesthetics) at /home/andrew/.julia/packages/Gadfly/cqMtH/src/statistics.jl:33
[10] render_prepare(::Plot) at /home/andrew/.julia/packages/Gadfly/cqMtH/src/Gadfly.jl:697
[11] render(::Plot) at /home/andrew/.julia/packages/Gadfly/cqMtH/src/Gadfly.jl:755
[12] draw at /home/andrew/.julia/packages/Gadfly/cqMtH/src/Gadfly.jl:864 [inlined]
[13] show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::MIME{Symbol("application/prs.juno.plotpane+html")}, ::Plot) at /home/andrew/.julia/packages/Gadfly/cqMtH/src/Gadfly.jl:971
[14] show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::String, ::Plot) at ./multimedia.jl:109
[15] displayinplotpane(::Plot) at /home/andrew/.julia/packages/Atom/wlPiw/src/display/showdisplay.jl:51
[16] display(::Atom.JunoDisplay, ::Plot) at /home/andrew/.julia/packages/Atom/wlPiw/src/display/showdisplay.jl:118
[17] display(::Any) at ./multimedia.jl:323
[18] #invokelatest#1 at ./essentials.jl:709 [inlined]
[19] invokelatest at ./essentials.jl:708 [inlined]
[20] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:156
[21] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:141
[22] (::REPL.var"#do_respond#38"{Bool,Atom.var"#232#233",REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:719
[23] (::REPL.var"#53#62")(::Any, ::Any, ::Vararg{Any,N} where N) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:987
[24] #invokelatest#1 at ./essentials.jl:709 [inlined]
[25] invokelatest at ./essentials.jl:708 [inlined]
[26] (::REPL.LineEdit.var"#27#28"{REPL.var"#53#62",String})(::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/LineEdit.jl:1356
[27] prompt!(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/LineEdit.jl:2398
[28] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/LineEdit.jl:2301
[29] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:1045
[30] run_repl(::REPL.AbstractREPL, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:201
[31] (::Base.var"#770#772"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:382
[32] #invokelatest#1 at ./essentials.jl:709 [inlined]
[33] invokelatest at ./essentials.jl:708 [inlined]
[34] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:366
[35] exec_options(::Base.JLOptions) at ./client.jl:304
[36] _start() at ./client.jl:460
Following the hint [Base.LogicalIndex(Bool[1])]
, I decided trying to wrap the data in a list:
p = plot(x=["Label"], y=[randn(10)], Geom.boxplot)
however that still gives me an error:
Error showing value of type Plot:
ERROR: MethodError: no method matching isnan(::Array{Float64,1})
Closest candidates are:
isnan(::BigFloat) at mpfr.jl:892
isnan(::Missing) at missing.jl:100
isnan(::Float16) at float.jl:536
...
Stacktrace:
[1] _quantilesort!(::Array{Array{Float64,1},1}, ::Bool, ::Float64, ::Float64) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Statistics/src/Statistics.jl:907
[2] #quantile!#49 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Statistics/src/Statistics.jl:885 [inlined]
[3] #quantile! at ./none:0 [inlined]
[4] #quantile#54(::Bool, ::typeof(Statistics.quantile), ::Array{Array{Float64,1},1}, ::Array{Float64,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Statistics/src/Statistics.jl:968
[5] quantile(::Array{Array{Float64,1},1}, ::Array{Float64,1}) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/Statistics/src/Statistics.jl:968
[6] apply_statistic(::Gadfly.Stat.BoxplotStatistic, ::Dict{Symbol,Gadfly.ScaleElement}, ::Gadfly.Coord.Cartesian, ::Gadfly.Aesthetics) at /home/andrew/.julia/packages/Gadfly/cqMtH/src/statistics.jl:1059
[7] apply_statistics(::Array{Gadfly.StatisticElement,1}, ::Dict{Symbol,Gadfly.ScaleElement}, ::Gadfly.Coord.Cartesian, ::Gadfly.Aesthetics) at /home/andrew/.julia/packages/Gadfly/cqMtH/src/statistics.jl:33
[8] render_prepare(::Plot) at /home/andrew/.julia/packages/Gadfly/cqMtH/src/Gadfly.jl:697
[9] render(::Plot) at /home/andrew/.julia/packages/Gadfly/cqMtH/src/Gadfly.jl:755
[10] draw at /home/andrew/.julia/packages/Gadfly/cqMtH/src/Gadfly.jl:864 [inlined]
[11] show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::MIME{Symbol("application/prs.juno.plotpane+html")}, ::Plot) at /home/andrew/.julia/packages/Gadfly/cqMtH/src/Gadfly.jl:971
[12] show(::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}, ::String, ::Plot) at ./multimedia.jl:109
[13] displayinplotpane(::Plot) at /home/andrew/.julia/packages/Atom/wlPiw/src/display/showdisplay.jl:51
[14] display(::Atom.JunoDisplay, ::Plot) at /home/andrew/.julia/packages/Atom/wlPiw/src/display/showdisplay.jl:118
[15] display(::Any) at ./multimedia.jl:323
[16] #invokelatest#1 at ./essentials.jl:709 [inlined]
[17] invokelatest at ./essentials.jl:708 [inlined]
[18] print_response(::IO, ::Any, ::Bool, ::Bool, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:156
[19] print_response(::REPL.AbstractREPL, ::Any, ::Bool, ::Bool) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:141
[20] (::REPL.var"#do_respond#38"{Bool,Atom.var"#232#233",REPL.LineEditREPL,REPL.LineEdit.Prompt})(::Any, ::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:719
[21] (::REPL.var"#53#62")(::Any, ::Any, ::Vararg{Any,N} where N) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:987
[22] #invokelatest#1 at ./essentials.jl:709 [inlined]
[23] invokelatest at ./essentials.jl:708 [inlined]
[24] (::REPL.LineEdit.var"#27#28"{REPL.var"#53#62",String})(::Any, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/LineEdit.jl:1356
[25] prompt!(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/LineEdit.jl:2398
[26] run_interface(::REPL.Terminals.TextTerminal, ::REPL.LineEdit.ModalInterface, ::REPL.LineEdit.MIState) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/LineEdit.jl:2301
[27] run_frontend(::REPL.LineEditREPL, ::REPL.REPLBackendRef) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:1045
[28] run_repl(::REPL.AbstractREPL, ::Any) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.3/REPL/src/REPL.jl:201
[29] (::Base.var"#770#772"{Bool,Bool,Bool,Bool})(::Module) at ./client.jl:382
[30] #invokelatest#1 at ./essentials.jl:709 [inlined]
[31] invokelatest at ./essentials.jl:708 [inlined]
[32] run_main_repl(::Bool, ::Bool, ::Bool, ::Bool, ::Bool) at ./client.jl:366
[33] exec_options(::Base.JLOptions) at ./client.jl:304
[34] _start() at ./client.jl:460
I got it working after massaging my data into a DataFrame, but I’d rather avoid it. So the question is: is there really no way to use Geom.boxplot
without DataFrames?