shinyMlr icon indicating copy to clipboard operation
shinyMlr copied to clipboard

switch plots from ggplot to ggvis?

Open Coorsaa opened this issue 8 years ago • 13 comments

ggvis has a similar structure to ggplot but produces interactive plots.

Coorsaa avatar Nov 22 '16 13:11 Coorsaa

What are the advantages over using plotly? For plotly you just have to change plotOutput to plotlyOutput and renderPlot to renderPlotly. It works flawless if renderPlot returns a ggplot.

Where would you want to have interactive plots the most?

jakob-r avatar Nov 22 '16 15:11 jakob-r

Thanks @jakob-r , I was hoping for that kind of input. After briefly looking into plotly, it seems that it would work pretty well for us. I was thinking of starting with it for the data summary plots with possible extensions for the prediction and benchmark plots. What do u think @florianfendt ?

Coorsaa avatar Nov 22 '16 16:11 Coorsaa

AFAIK plotly plots can't be embedded as nicely (i.e. they're hosted on plotly's website). This may be something to consider.

larskotthoff avatar Nov 22 '16 17:11 larskotthoff

What about Highcharter?

Haven't used ggvis in a while, but I remember it's development was slowed due to vega missing some pieces. That was a year ago so it may be much better now.

SteveBronder avatar Nov 22 '16 18:11 SteveBronder

So Highcharter doesn't have plotly's embedding disadvantage? It seems to be very flexible and it has a broad variety of different plot types.

Coorsaa avatar Nov 22 '16 20:11 Coorsaa

I'm a big fan of highcharts! Though I've never used this particular package, I do not see why you would have to embed it like you do with plotly. It should output the html needed to integrate with shiny. I believe it's backend is partly based on htmlwidgets which is supposed to integrate with shiny very well.

SteveBronder avatar Nov 22 '16 20:11 SteveBronder

ok sounds great! Thanks for your support and ideas!

Coorsaa avatar Nov 22 '16 20:11 Coorsaa

Hmm, from the htmlwidgets page that you link to it looks like you can actually embed plotly plots (they do it there). The big advantage of plotly is that you can export and save the plots.

larskotthoff avatar Nov 22 '16 21:11 larskotthoff

@larskotthoff Right, you can export and save. However, exporting to PDF format is only possible if you pay money. E.g., https://plot.ly/~chris/1638/ (interactive version) https://plot.ly/~chris/1638.png (possible) https://plot.ly/~chris/1638.pdf (payment required ...)

jakobbossek avatar Nov 22 '16 22:11 jakobbossek

Ok, but at least it gives you that option. Is there an easy way in shiny to make plots available as downloadable PDFs?

larskotthoff avatar Nov 22 '16 22:11 larskotthoff

AFAIK plotly plots can't be embedded as nicely (i.e. they're hosted on plotly's website). This may be something to consider.

No. Plotly works totally fine offline. It just relies on JavaScript. You can publish but this is just an additional feature. Try the examples here. It uses htmlwidgets as well as highcharts and so on.

Is there an easy way in shiny to make plots available as downloadable PDFs?

Just a quick search result: http://shiny.rstudio.com/gallery/download-knitr-reports.html This obviously would not work directly with things that use htmlwidgets.

jakob-r avatar Nov 23 '16 08:11 jakob-r

@Coorsaa plotly really looks great but if we can't export pdfs easily I'd vote for staying with ggplot for now and at least make pdf download available soon. If we have time later we can try make the plots interactive. What do you reckon?

florianfendt avatar Nov 23 '16 08:11 florianfendt

I worked on this today a bit and if you go with the approach in the link I provided it is easy to do ggplot and plotly together. The major disadvantage is that you need a separate Rmd file that serves as a template like for a report to generate a pdf. You can also extract the intermediate markdown files of the pdf generation and offer a zip download of the single plots.

This leads me to think that with some cleverness you call ggsave on all ggplot objects and than download them.

jakob-r avatar Nov 23 '16 16:11 jakob-r