We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
g <- pathway("ko00520") V(g)$color_1 <- colorRampPalette(RColorBrewer::brewer.pal(5,"Set1"))(length(V(g))) V(g)$color_2 <- colorRampPalette(RColorBrewer::brewer.pal(5,"Set2"))(length(V(g))) V(g)$color_3 <- colorRampPalette(RColorBrewer::brewer.pal(5,"PuOr"))(length(V(g))) V(g)$color_4 <- colorRampPalette(RColorBrewer::brewer.pal(5,"Paired"))(length(V(g)))
V(g)$space <- V(g)$width/4
tem_plot = ggraph(g, x=x, y=y) for (i in c(1:4)){ tem_plot = tem_plot + geom_node_rect( aes(xmin= xmin + (i-1) * space, xmax= xmin + i * space, fill=I(get(paste0('color_', i))), filter=type=="ortholog")) }
tem_plot
The text was updated successfully, but these errors were encountered:
I also tried the technique by passing '.data' variable mention by: https://stackoverflow.com/questions/15987367/how-to-add-layers-in-ggplot-using-a-for-loop
Sorry, something went wrong.
Hi, thank you for your inquiry and I apologize for the very late response. You can use !! inside aes for evaluating the number like:
!!
g <- pathway("ko00520") V(g)$color_1 <- colorRampPalette(RColorBrewer::brewer.pal(5,"Set1"))(length(V(g))) V(g)$color_2 <- colorRampPalette(RColorBrewer::brewer.pal(5,"Set2"))(length(V(g))) V(g)$color_3 <- colorRampPalette(RColorBrewer::brewer.pal(5,"PuOr"))(length(V(g))) V(g)$color_4 <- colorRampPalette(RColorBrewer::brewer.pal(5,"Paired"))(length(V(g))) V(g)$space <- V(g)$width/4 tem_plot = ggraph(g, x=x, y=y) for (i in seq_len(4)){ tem_plot = tem_plot + geom_node_rect( aes(xmin= .data$xmin + .data$space*!!(i-1), xmax= .data$xmin + .data$space*!!(i), fill=I(get(paste0('color_', !!i))), filter=type=="ortholog")) } tem_plot
Hope this helps and I'll try to implement functions like geom_node_rect_multi for visualization for this purpose.
geom_node_rect_multi
geom_node_rect_multi implemented from version 1.3.3.
No branches or pull requests
g <- pathway("ko00520")
V(g)$color_1 <- colorRampPalette(RColorBrewer::brewer.pal(5,"Set1"))(length(V(g)))
V(g)$color_2 <- colorRampPalette(RColorBrewer::brewer.pal(5,"Set2"))(length(V(g)))
V(g)$color_3 <- colorRampPalette(RColorBrewer::brewer.pal(5,"PuOr"))(length(V(g)))
V(g)$color_4 <- colorRampPalette(RColorBrewer::brewer.pal(5,"Paired"))(length(V(g)))
V(g)$space <- V(g)$width/4
tem_plot = ggraph(g, x=x, y=y)
for (i in c(1:4)){
tem_plot = tem_plot + geom_node_rect(
aes(xmin= xmin + (i-1) * space,
xmax= xmin + i * space,
fill=I(get(paste0('color_', i))),
filter=type=="ortholog"))
}
tem_plot
The text was updated successfully, but these errors were encountered: