Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why the color in network shows different with my settings #447

Open
chenc327 opened this issue Nov 22, 2022 · 1 comment
Open

why the color in network shows different with my settings #447

chenc327 opened this issue Nov 22, 2022 · 1 comment

Comments

@chenc327
Copy link

Hi, thanks for this outstanding tools.I'm just a beginner in this software
I WANT to know why the color in network shows different with my settings in node.
I have setted the color to be orange and grey, but finally got a plot in different color. THANKS

node <- data.frame(id = unique(c(edge$from,edge$to)),
                   label = c(unique(edge$from),rep(NA,308)),
                   group = c(rep('Regulon',12),rep('target',308)),
                   value = (as.numeric(c(rep(4,12),table(edge$to))))*5,
                   shape = c(rep('square',12),rep('circle',308)),
                   color = c(rep('orange',12),rep('grey',308))
                   )
visNetwork(node, edge, width = 500, height = 500, main = "prog network")

image

@bthieurmel
Copy link
Contributor

bthieurmel commented Dec 1, 2022

If you are using groups, you have to defined groups options using visGroups

?visGroups

nodes <- data.frame(id = 1:10, label = paste("Label", 1:10), 
 group = sample(c("A", "B"), 10, replace = TRUE))
 edges <- data.frame(from = c(2,5,10), to = c(1,2,10))

visNetwork(nodes, edges) %>%
 visLegend() %>%
 visGroups(groupname = "A", color = "red", shape = "database") %>%
 visGroups(groupname = "B", color = "yellow", shape = "triangle")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants