# Just \`using Gadfly\` introduces a method error when calling AlgebraOfGraphics \`draw()\`

**URL:** https://discourse.julialang.org/t/just-using-gadfly-introduces-a-method-error-when-calling-algebraofgraphics-draw/63296
**Category:** New to Julia
**Tags:** error
**Created:** [June 21, 2021, 1:53pm UTC](https://discourse.julialang.org/t/just-using-gadfly-introduces-a-method-error-when-calling-algebraofgraphics-draw/63296 "2021-06-21T13:53:57Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jonasjonker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jonasjonker/32/22535_2.png) [@jonasjonker](https://discourse.julialang.org/u/jonasjonker)
#### Post date: [June 21, 2021, 1:53pm UTC](https://discourse.julialang.org/t/just-using-gadfly-introduces-a-method-error-when-calling-algebraofgraphics-draw/63296/1 "2021-06-21T13:53:57Z")

</div>

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](https://giovineitalia.github.io/Compose.jl/latest/) 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
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)

```

 ![iris](https://global.discourse-cdn.com/julialang/original/3X/e/7/e7e602f8f77b49250872704525aa334fb98aab19.png)

### using Gadfly introduces an error.

```julia
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
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

```

---

<div class="post-metadata">

### Author: ![jonasjonker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jonasjonker/32/22535_2.png) [@jonasjonker](https://discourse.julialang.org/u/jonasjonker)
#### Post date: [June 22, 2021, 9:12pm UTC](https://discourse.julialang.org/t/just-using-gadfly-introduces-a-method-error-when-calling-algebraofgraphics-draw/63296/2 "2021-06-22T21:12:05Z")

</div>

I couldn’t figure it out but I raised an [issue](https://github.com/JuliaPlots/AlgebraOfGraphics.jl/issues/215) and somebody else on github did.

[Compose.jl](https://github.com/GiovineItalia/Compose.jl/blob/master/src/property.jl#L71) commits type piracy:

```julia
71 fill(c::Nothing) = Fill([FillPrimitive(RGBA{Float64}(0.0, 0.0, 0.0, 0.0))])

```

Which impacts [AlgebraOfGraphics.jl](https://github.com/JuliaPlots/AlgebraOfGraphics.jl/blob/master/src/algebra/processing.jl#L16) here:

```julia
16 arrays = map(var -> var isa ArrayLike ? var : fill(nothing), allvariables(x))

```
