The unravelled layout is essentially a scatterplot of network properties with interactions drawn as well. This is inspired by the work of Giulio V. Dalla Riva on this visualisation. By default, it will compare the omnivory index and the trophic level:
Layouts
EcologicalNetworksPlots.UnravelledInitialLayout
— TypeUnravelledInitialLayout
This type is used to generate an initial unravelled layout, where the nodes are sorted vertically by trophic level, and horizontally by omnivory index. Credit for this approach goes to @gvdr – https://github.com/gvdr/unravel#unravel
EcologicalNetworksPlots.UnravelledLayout
— TypeUnravelledLayout
Parameters are
x
(a function to get the value on x)y
(a function to get the value on y)
Both of these functions must accept a unipartite network as input, and return a dictionary with species and a single numerical value as output. Note that x
and/or y
can be λ
s.
Example
N = nz_stream_foodweb()[10]
I = initial(UnravelledInitialLayout, N)
plot(I, N, lab="", framestyle=:box)
scatter!(I, N, nodefill=degree(N), colorbar=true, framestyle=:box)
Because a lot of species will have the same omnivory index, we might want to use a slightly different function, which adds some randomness to the omnivory:
N = nz_stream_foodweb()[10]
I = initial(UnravelledInitialLayout, N)
function random_omnivory(N::T) where {T <: UnipartiteNetwork}
o = omnivory(N)
for s in species(N)
o[s] += (rand()-0.5)*0.1
end
return o
end
UL = UnravelledLayout(x=random_omnivory, y=trophic_level)
position!(UL, I, N)
plot(I, N, lab="", framestyle=:box)
scatter!(I, N, nodefill=degree(N), colorbar=true, framestyle=:box, mc=:viridis)