brainconn
brainconn copied to clipboard
brainconn(): edge.color cannot be changed with edge.color.weighted = T
When edge.color.weighted set to TRUE, the edge color would always be the default "blue" no matter what other colours are set.
Hi - thanks for pointing this out! I will add an option to allow for color scales to be entered when using edge.color.weighted. In the meantime, here is a workaround to include colour scales using ggraph's "scale_edge_colour*":
library(brainconn)
conmat <- brainconn::example_weighted_undirected
brain <- brainconn(atlas = 'schaefer300_n7', conmat = conmat, edge.color.weighted = T)
brain + scale_edge_colour_gradient2(low='yellow', mid='orange', high='red')
brain + scale_edge_colour_distiller(palette = 2)
brain + scale_edge_colour_viridis()
brain + scale_edge_colour_gradientn(colours = pals::parula())
See here for more options and detials.
Thanks and let me know if there is anything else you need.
Hello, I tried using this fix for the weighted scale today but it doesn't seem to override the default blue scale for me. This is the code I'm using:
c_serum_brain <- brainconn(atlas = custom_atlas, conmat = c_serum, node.size = 1.5, view = "ortho", edge.width = 1, edge.color.weighted = T)
c_serum_brain + scale_edge_colour_gradient2(low='yellow', mid='orange', high='red')
I tried restarting R, using a different conmat, and trying all the scales above but still had the same blue scale output. Just wanted to check in and see if anything had been updated since this initial post! Thanks!
I haven't incorporated this feature into brainconn yet, but the fix above should still work. If you want to attach your custom_atlas and conmat - ill take a look.
Great, thanks so much! This is the custom atlas: node_coords.csv
and this is one of the connectivity matrices I'm analyzing: 28andHe_CSerum.csv
Hi - this was indeed a bug with the "ortho" view.
I have now fixed this and changed the code to allow for any "scale_edge_colour*" function from ggraph to be directly passed to edge_color
, if edge.color.weighted = T
. Try reinstalling the package, and trying the below:
brainconn(atlas = custom_atlas, conmat = c_serum, node.size = 1.5, view = "ortho", edge.width = 0.8, edge.color.weighted = T, edge.color = scale_edge_colour_gradient2(low='yellow', mid='orange', high='red'))
yes that worked! thank you so much for your help