Hi! I’m making a graph based on an adjacency matrix of 1’s and 2’s (which indicates which colour the edge should be). Currently, I can’t colour individual edges like shown in the third example of this page.
I think this is because I’m using graphplot!(ax, …) instead of f, ax, p = graphplot() because I have multiple axes that I’m plotting. I don’t know how to use f, ax, p = graphplot() and then put that into a gridlayout().
g = SimpleDiGraph(ODENetworkModel.num_nodes)
fig = Figure(size = (1920, 1080))
# create graph visualisation
ax1 = Axis(network_and_init[1,1], title = "$(ODENetworkModel.num_nodes) Node System", width = 250, height = 250, xrectzoom = false, yrectzoom = false)
println("Created network...")
edge_colours = []
for i in 1:ODENetworkModel.num_nodes
for j in 1:ODENetworkModel.num_nodes
if ODENetworkModel.adj_matrix[i,j] == 1
add_edge!(g, i, j)
push!(edge_colours,1)
elseif ODENetworkModel.adj_matrix[i,j] == 2
add_edge!(g, i, j)
push!(edge_colours,2)
end
end
end
p = graphplot!(ax1, g, ilabels = [i for i in 1:ODENetworkModel.num_nodes], nlabels = parameter_labels(ODENetworkModel.num_nodes, ODENetworkModel.par_adj_matrix))
# trying to change the colour of JUST some edges, but this doesn't work because I need to use graphplot, but I can't do that because I need to put it into the right gridlayout
# for edge in 1:length(edge_colours)
# if edge_colours[edge] == 2
# p.edge_color[][edge] = :red
# end
# end
p.edge_color[] = :red # turns all of the edges red...
p.edge_color = p.edge_color[] # trigger observable
I thought that p.edge_color was a list of Symbols (colours)? But in my code it is just one colour…
Many thanks