AlgebraOfGraphics.jl
AlgebraOfGraphics.jl copied to clipboard
Passing facet attributes to draw
I'm not sure how to specify grid and spines of a facet through draw
, nor can I find an answer in the docs. The code below worked a few weeks ago, but no longer. If anyone can tell me how I would hide the grid and spines, I can PR to the docs and close this. Otherwise I'll come back with a MWE.
I have some code that worked a few weeks ago like:
plt = # a plot with facets
axis = (height=50, width=500)
facet = (; linkyaxes = :none, grid=false, spines=false)
fg = draw(plt; axis, facet)
but now facet
doesn't accept the grid and spines arguments. Instead I get an error:
ERROR: LoadError: MethodError: no method matching clean_facet_attributes(::Matrix{AxisEntries}; linkyaxes=:none, grid=false, spines=false)
Closest candidates are:
clean_facet_attributes(::Any; linkxaxes, linkyaxes, hidexdecorations, hideydecorations) at C:\Users\graha\.julia\packages\AlgebraOfGraphics\8WZVt\src\facet.jl:27 got unsupported keyword arguments "grid", "spines"
Stacktrace:
[1] kwerr(::NamedTuple{(:linkyaxes, :grid, :spines), Tuple{Symbol, Bool, Bool}}, ::Function, ::Matrix{AxisEntries})
@ Base .\error.jl:157
[2] facet_grid!(fig::Figure, aes::Matrix{AxisEntries}; facet::NamedTuple{(:linkyaxes, :grid, :spines), Tuple{Symbol, Bool, Bool}})
@ AlgebraOfGraphics C:\Users\graha\.julia\packages\AlgebraOfGraphics\8WZVt\src\facet.jl:144
[3] #43
@ C:\Users\graha\.julia\packages\AlgebraOfGraphics\8WZVt\src\facet.jl:165 [inlined]
[4] update
@ C:\Users\graha\.julia\packages\AlgebraOfGraphics\8WZVt\src\draw.jl:10 [inlined]
[5] #facet!#42
@ C:\Users\graha\.julia\packages\AlgebraOfGraphics\8WZVt\src\facet.jl:163 [inlined]
[6] #facet!#45
@ C:\Users\graha\.julia\packages\AlgebraOfGraphics\8WZVt\src\facet.jl:171 [inlined]
[7] (::AlgebraOfGraphics.var"#226#227"{NamedTuple{(:height, :width), Tuple{Int64, Int64}}, NamedTuple{(), Tuple{}}, NamedTuple{(:linkyaxes, :grid, :spines), Tuple{Symbol, Bool, Bool}}, NamedTuple{(), Tuple{}}, NamedTuple{(), Tuple{}},
Layer})(f::Figure)
@ AlgebraOfGraphics C:\Users\graha\.julia\packages\AlgebraOfGraphics\8WZVt\src\draw.jl:48
[8] update
@ C:\Users\graha\.julia\packages\AlgebraOfGraphics\8WZVt\src\draw.jl:10 [inlined]
[9] #draw#225
@ C:\Users\graha\.julia\packages\AlgebraOfGraphics\8WZVt\src\draw.jl:45 [inlined]
That code was refactored recently. I confess I was not aware that the syntax above was at all possible (it was definitely not tested), but I don't think it is necessary. Still, very sorry for breaking it in a supposedly non-breaking release!
I think any attribute that is passed to axis
should be forwarded to Makie, so I imagine you should pass
axis = (height=50, width=500, xgridvisible=false, ygridvisible=false, spinewidth=0) # or `leftspinevisible=0` etc...
and it should style the axis according.