Coorsaa/shinyMlr

switch plots from ggplot to ggvis?

Opened this issue · 13 comments

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

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?

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 ?

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

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.

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.

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.

ok sounds great! Thanks for your support and ideas!

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 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 ...)

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

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.

@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?

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.