Closed martinamorris closed 10 years ago
currently the colors in the legend only match the corresponding nodes for numeric attributes.
how does plot.network translate a non-numeric attribute into a color?
it uses network's (undocumented) as.color() function: as.color function (x) { if (is.numeric(x)) { if (any(x != round(x), na.rm = TRUE)) { return(gray((x - min(x))/(max(x) - min(x)))) } else return(x) } if (is.factor(x)) { return(match(levels(x)[x], levels(x))) } if (is.character(x)) { if (all(is.color(x))) return(x) else { return(match(x, sort(unique(x)))) } } }
which seems to be basically mapping each element (or factor level) to an integer value and then using the default palette
Thanks Skye!
The fill colors are fixed in commit cc4e503
fix colors