-
Notifications
You must be signed in to change notification settings - Fork 266
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
Some colors ignored in sankeyNetwork(colourScale = ...) #242
Comments
This happens because there is a space in "up to date". If you change the group value and the value in your color domain to ""up-to-date", it should work as expected. pretty sure this is caused by this line: not sure if that line has some other important purpose |
Thanks CJ, I would not have expected that. Removing spaces works. For my own application, this is an acceptable workaround. nodes <- data.frame(
id = letters[1:3],
label = c("blue", "green", "black"),
status = c("imported", "up-to-date", "outdated"),
stringsAsFactors = FALSE
)
edges <- data.frame(
src = c(0, 0, 1),
target = c(2, 1, 2),
value = 1
)
color <- "d3.scaleOrdinal() .domain(['imported', 'up-to-date', 'outdated']) .range(['#1874CD', '#228B22', '#000000'])"
networkD3::sankeyNetwork(
Links = edges,
Nodes = nodes,
NodeID = "label",
Source = "src",
Target = "target",
NodeGroup = "status",
Value = "value",
colourScale = color,
fontSize = 16
) |
We should at least at a note to the documentation that group values must not have a space. Allowing for spaces in the group name would break backwards compatibility, so I'm not sure we should do that. |
another note - it appears that you can't use color names with a number in them. i.e. "hotpink" is fine but "hotpink3" won't show up |
I would only expect color names from these lists to work as expected... otherwise, one can specify a color in hex or rgba |
The following graph should have a green node, but it appears blue. Tested with both the CRAN release and 9c0a9c9.
The text was updated successfully, but these errors were encountered: