girke-lab / signatureSearch

R/Bioconductor package including the Gene Expression Signature Search (GESS), Function Enrichment Analysis (FEA) methods and supporting drug-target network construction for visualization
17 stars 4 forks source link

Save dtnetplot output as a static image #6

Closed aadamk closed 3 years ago

aadamk commented 3 years ago

Hello, Is it possible to save the dtnetplot output as a static pdf image?

I have unsuccessfully attempted to save as an html then use webshot to capture in a pdf with the following code:

visSave(plot, html_name)

library(webshot); webshot::install_phantomjs() 

webshot(html_name, zoom = 2, file = "ex.pdf")

However, my output looks like the following:

image

yduan004 commented 3 years ago

Hi, I usually save the dtnetplot output either by clicking the Export button in Rstudio or by clicking show in new window button or save it as a webpage to load it via Chrome and take a screenshot.

Using webshot package is also a good choice! Thanks for coming up with it. The webshot function has the delay argument to allow time to wait before taking a screenshot in seconds. It takes some time to load the dtnetplot HTML page. So please remember to set the delay argument as 1 or 2 minutes. The code will be like

webshot(html_name, zoom = 1, file = "tmp.pdf", delay=60)

Hope it works for you.

Best, Yuzhu

aadamk commented 3 years ago

Many thanks for the suggestions Yuzhu! The delay argument solved it. Closing this issue. Best, Adam