I am trying to plot a 2x2 figure as shown below.
So I
import CairoMakie
for ir in 1:2, ic in 1:2
g = f[ir,ic] = GridLayout()
# handling g below
end
But if I try the following code:
for ir in 1:2, ic in 1:2
f[ir,ic] = GridLayout()
# handling f[ir,ic] directly below
end
By handing I mean codes like:
Axis(g[1,1]);
colsize!(g, 1, Relative(2/3))
colgap!(g, 0)
Label(g[1, 1:2, Top()], gridtitles[ir][ic], textsize = 26)
, or
Axis(f[ir,ic][1,1]);
colsize!(f[ir,ic], 1, Relative(2/3))
colgap!(f[ir,ic], 0)
Label(f[ir,ic][1, 1:2, Top()], gridtitles[ir][ic], textsize = 26)
My question is, when handled by g
everything works fine; but not by f[ir,ic]
. Here is the error info:
ERROR: LoadError: MethodError: no method matching colsize!(::GridPosition, ::Int64, ::Relative)
Closest candidates are:
colsize!(::GridLayout, ::Int64, ::GridLayoutBase.ContentSize) at /home/dongjx/.julia/packages/GridLayoutBase/nYdeK/src/gridlayout.jl:552
colsize!(::GridLayout, ::Int64, ::Real) at /home/dongjx/.julia/packages/GridLayoutBase/nYdeK/src/gridlayout.jl:560
This is quite weird to me, because in my view g = f[ir,ic] = GridLayout()
is nothing but renaming f[ir,ic]
as g
, and I should handle them the same.
Why is that?