Closed qinzhu closed 5 years ago
You should pass time
unquoted in aes()
as per ggplot2 conventions
Hi @thomasp85!
hey, I was wondering how can I manually specify the color of the edges using geom_edge_elbow2. I am building a dendogram that has 5 main arms. I would like to have colors per arm but also different tones within arm.
I built a color variable in the edges data that has the color names I would like the edges to be. But I get the following problem:
"Error: Discrete value supplied to continuous scale"
This is what I am doing:
colors.for.dend=c("#7F00FF","#CC0000", "#00CC00", "#0080FF", "#404040", "white", rep("#FF3333", 5), rep("white", 3), rep("#B266FF", 1), rep("#FF6666",6), rep("#66FF66", 2), rep("#66B2FF", 2), "#606060", rep("#E5CCFF", 24), rep("#FFCCCC", 57-24), rep("#CCFFCC",66-57), rep("#CCE5FF", 89-66), rep("#E0E0E0",4), rep("#CC99FF", 5), rep("#FF9999", 14), rep("#99FF99",5), rep("#99CCFF", 40-24), rep("#C0C0C0",3))
dat.graph.2[[1]]$color=colors.for.dend
names(dat.graph.2) = c("edges", "vertices")
graph <- tbl_graph(dat.graph.2$vertices, dat.graph.2$edges)
geom_edge_elbow2(aes(edge_width= size*0.1, colour=color), linejoin = "round", lineend = "butt")
Hopefully you can help and thank you very much for the packages man...
RT. Please see attached code and output for details:
Another related issue is I wonder if it's possible to specify edge length in dendrogram. Thanks!