igm-team / subrvis

MIT License
4 stars 3 forks source link

Saving the gene.plot locally as svg file #1

Open Yatros opened 7 years ago

Yatros commented 7 years ago

Hello,

I downloaded your package, because I would like to make high resolution figures with your package for publication purposes. I would like to have the output plot not only in png format but also as a vectorial figure.

Is there a way of modifying the code of the geneplots.R file so that I do not only get the png format of the plot, but that I can also save the plot locally in svg format?

I have been able to add the Download Data and Download Plot to the web browser by adding this code to the ui.R file:

[...]
actionButton("plot", label = "Plot"),
downloadButton('downloadData', 'Download Table'),
downloadButton('downloadPlot', 'Download Plot')
). 
[...]

and by adding the following code to the server.R file:

[...]
return(plot.table)

    output$downloadData <- downloadHandler(
            filename = function() { paste(input$gene, '.csv', sep='') },
            content = function(file) {
                    write.csv(datatasetInput(), file)
            })

    output$downloadPlot <- downloadHandler(
            filename = function() { paste(input$gene, '.svg', sep='') },
            content = function(gene.plot) {
                    device <- function(gene.plot, width, height) {
                            grDevices::svg(gene.plot, width = width, height = height,
                                           res = 300, units = "in")
                    }
                    ggsave(Test, plot = gene.plot, device = device)
            })
[...]

The problem is that I don't know how to redirect the Table content and the plot content to these two buttons so that I can download them.

Can you please add this feature to your code?

Thank you very much,

Best,

Yatros

Yatros commented 7 years ago

Hello

I have modified the code to download the table, but I'm still unable to download the pictures from the online tool. I can download them from Rstudio though.

If I manage to modify everything I will pull the changes,

Thanks,

Oswaldo

gussow commented 6 years ago

Hello Oswaldo,

Thanks for your input - this sounds like a feature that would be of general use.

If you do manage to modify the code accordingly, please do submit a PR.

Ayal