plotKegg <- function(enrichdf, nrows = 30, orderby=NULL){
require(plotly)
if(!is.data.frame(enrichdf)){
stop("enrichdf should be data.frame")
}
if(!is.null(orderby)){
orderby = match.arg(orderby, c("DE", "P.DE", "N", "Pathway"))
if(orderby=="P.DE" | orderby =="Pathway"){
enrichdf <- enrichdf %>% arrange(get(orderby))
} else{ enrichdf <- enrichdf %>% arrange(desc(get(orderby)))}
}
p <- enrichdf[1:nrows,] %>%
plot_ly(x=~DE, y=~pathID, text=~Pathway, type = "bar",
marker = list(color='rgb(117,107,177)'),
orientation = "v") %>%
layout(margin = list(l=100), yaxis = list(title=""),
title="Kegg pathways")
return(p)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.