I’m making a notebook where I try out several plotting packages side by side. However just using Gadfly
introduces a MethodError when calling AlgebraOfGraphics.draw()
.
The error MethodError: no method matching size(::Compose.Property{Compose.FillPrimitive})
is caused by Compose.jl which is a backend for Gadfly. I would like to report this error, but I’m not really sure which package is to blame, AlgebraOfGraphics.jl or Gadfly.jl/Compose.jl. Or is there something that I should have done/can do to prevent this error?
AlgebraOfGraphics without Gadfly works fine
julia> using AlgebraOfGraphics, RDatasets, CairoMakie
julia> const AoG = AlgebraOfGraphics
julia> iris = dataset("datasets", "iris")
julia> iris_frequency = AoG.data(iris) *
AoG.mapping(:PetalLength, :PetalWidth) *
AoG.mapping(color = :Species)
# works fine
julia> fg1 = AoG.draw(iris_frequency)
julia> save("figure.png", fg1, px_per_unit = 3)
using Gadfly introduces an error.
julia> using Gadfly
# now throws an error
julia> fg2 = AoG.draw(iris_frequency)
ERROR: MethodError: no method matching size(::Compose.Property{Compose.FillPrimitive})
Closest candidates are:
size(::Union{LinearAlgebra.QR, LinearAlgebra.QRCompactWY, LinearAlgebra.QRPivoted}) at /opt/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/qr.jl:524
size(::Union{LinearAlgebra.QR, LinearAlgebra.QRCompactWY, LinearAlgebra.QRPivoted}, ::Integer) at /opt/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/qr.jl:523
size(::Union{LinearAlgebra.Cholesky, LinearAlgebra.CholeskyPivoted}) at /opt/julia/usr/share/julia/stdlib/v1.6/LinearAlgebra/src/cholesky.jl:442
...
Stacktrace:
[1] axes
@ ./abstractarray.jl:89 [inlined]
[2] combine_axes(::Compose.Property{Compose.FillPrimitive}, ::Compose.Property{Compose.FillPrimitive}, ::Compose.Property{Compose.FillPrimitive})
@ Base.Broadcast ./broadcast.jl:483
[3] shape(x::AlgebraOfGraphics.Layer)
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/4qspg/src/algebra/processing.jl:17
[4] getlabeledarray(layer::AlgebraOfGraphics.Layer, s::Symbol)
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/4qspg/src/algebra/processing.jl:72
[5] (::AlgebraOfGraphics.var"#119#121"{Tuple{Symbol, Symbol}, AlgebraOfGraphics.Layer, Dict{Union{Int64, Symbol}, Any}})(key::Int64)
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/4qspg/src/algebra/processing.jl:100
[6] ntuple
@ ./ntuple.jl:19 [inlined]
[7] mapkeys
@ ~/.julia/packages/AlgebraOfGraphics/4qspg/src/entries.jl:75 [inlined]
[8] (::AlgebraOfGraphics.var"#118#120"{AlgebraOfGraphics.Layer, Dict{Union{Int64, Symbol}, Any}})(tup::Tuple{Symbol, Symbol})
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/4qspg/src/algebra/processing.jl:99
[9] map
@ ./tuple.jl:214 [inlined]
[10] process_mappings(layer::AlgebraOfGraphics.Layer)
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/4qspg/src/algebra/processing.jl:98
[11] to_entry(layer::AlgebraOfGraphics.Layer)
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/4qspg/src/algebra/processing.jl:115
[12] process(layer::AlgebraOfGraphics.Layer)
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/4qspg/src/algebra/processing.jl:122
[13] iterate
@ ./generator.jl:47 [inlined]
[14] collect(itr::Base.Generator{AlgebraOfGraphics.Layers, typeof(AlgebraOfGraphics.process)})
@ Base ./array.jl:678
[15] map
@ ./abstractarray.jl:2323 [inlined]
[16] compute_axes_grid(fig::Figure, s::AlgebraOfGraphics.Layer; axis::NamedTuple{(), Tuple{}}, palettes::NamedTuple{(), Tuple{}})
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/4qspg/src/algebra/layers.jl:70
[17] plot!(fig::Figure, s::AlgebraOfGraphics.Layer; axis::NamedTuple{(), Tuple{}}, palettes::NamedTuple{(), Tuple{}})
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/4qspg/src/algebra/layers.jl:135
[18] #plot#91
@ ~/.julia/packages/AlgebraOfGraphics/4qspg/src/algebra/layers.jl:143 [inlined]
[19] draw(s::AlgebraOfGraphics.Layer; axis::NamedTuple{(), Tuple{}}, figure::NamedTuple{(), Tuple{}}, palettes::NamedTuple{(), Tuple{}})
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/4qspg/src/algebra/layers.jl:150
[20] draw(s::AlgebraOfGraphics.Layer)
@ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/4qspg/src/algebra/layers.jl:150
[21] top-level scope
@ REPL[14]:1
I checked that the following returns the same before and after using Gadfly
:
julia> typeof(iris_frequency)
AlgebraOfGraphics.Layer
help?> AoG.draw
No documentation found.
AlgebraOfGraphics.draw is a Function.
# 1 method for generic function "draw":
[1] draw(s::Union{AlgebraOfGraphics.Layer, AlgebraOfGraphics.Layers}; axis, figure, palettes) in AlgebraOfGraphics at /home/me/.julia/packages/AlgebraOfGraphics/4qspg/src/algebra/layers.jl:148