Skip to content

Commit

Permalink
adding new constructor and plotting bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PavanChaggar committed Oct 27, 2023
1 parent 191c7ac commit 7ebe9aa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/graphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ function Connectome(parc::Parcellation, c::Connectome)
Connectome(parc, c.graph, c.n_matrix, c.l_matrix, c.weight_function)
end

function Connectome(A::AbstractMatrix, parc::Parcellation)
G = SimpleWeightedGraph(A)
Connectome(parc, G, A, A, (n, l) -> n)
end

# function Connectome(A::AbstractMatrix, c::Connectome)
# G = SimpleWeightedGraph(A)
# Connectome(c.parc, G, c.n_matrix, c.l_matrix, c.weight_function)
Expand Down
5 changes: 3 additions & 2 deletions src/plotting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ function plot_connectome!(connectome::Connectome;
node_size = 10.0)

g = connectome.graph
positions = Point.(zip(connectome.parc.x, connectome.parc.y, connectome.parc.z))
coords = get_coords(connectome.parc)
positions = Point.(zip(coords[:,1], coords[:,2], coords[:,3]))

if edge_weighted
ew = get_edge_weight(connectome)
Expand All @@ -114,7 +115,7 @@ function plot_connectome!(connectome::Connectome;
min_edge_size, max_edge_size)
else
edge_color = [colorant"grey" for i in 1:ne(g)]
edge_width = fill(edge_size, ne(g))
edge_width = fill(max_edge_size, ne(g))
end

if node_weighted
Expand Down

0 comments on commit 7ebe9aa

Please sign in to comment.