montilab / hypeR

An R Package for Geneset Enrichment Workflows
https://montilab.github.io/hypeR-docs/
GNU General Public License v3.0
76 stars 11 forks source link

Plots not diplaying in jupyter notebook #28

Closed Hrovatin closed 3 years ago

Hrovatin commented 3 years ago

Plots are not being displayed within jupyter notebook, this is due visNetwork. It would be nice to fix it as interactive charts are possible within notebooks (maybe see https://altair-viz.github.io/user_guide/display_frontends.html). However, if this is not possible at least add an option to save a plot so that it can be opened separately, e.g.:


    graph=visNetwork(nodes, edges, main=list(text=title, style="font-family:Helvetica")) %>%
    visNodes(borderWidth=1, borderWidthSelected=0) %>%
    visEdges(color="rgb(88,24,69)") %>%
    visOptions(highlightNearest=TRUE) %>%
    visInteraction(multiselect=TRUE, tooltipDelay=300) %>%
    visIgraphLayout(layout="layout_nicely")
    if (!is.null(file)) visSave(graph, file=paste0(file,'.html'), 
                                selfcontained = TRUE, background = "white")
anfederico commented 3 years ago

Good to know regarding Jupyter. Unfortunately the downside of visNetwork is an inability to render high-resolution images to a file. It's more of an interactive tool. The good news is it should be pretty easy to add some alternatives for saving. Let me mull over some options to incorporate.

anfederico commented 3 years ago

Sorry for the delay on this. Since the output from hyp_emap() or hyp_hmap() is the visNetwork object. You might be able to try something like this for Jupyter notebooks if they are still having issues.

vn <- hyp_hmap(hyp)
vn <- visOptions(vn, width="1200px", height="800px")
visNetwork::visSave(vn, "plot.html")
Hrovatin commented 3 years ago

Thank you.