corybrunson / ggalluvial

ggplot2 extension for alluvial plots
http://corybrunson.github.io/ggalluvial/
GNU General Public License v3.0
497 stars 34 forks source link

shiny vignette images #82

Closed corybrunson closed 3 years ago

corybrunson commented 3 years ago

The revised Shiny vignette, viewable on the ggalluvial website exhibits some problems that did not arise in early checks. Specifically, the change in zooming of images had too profound an effect, and the embedded apps do not show. These must be resolved before submission to CRAN.

corybrunson commented 3 years ago

@qdread would it help for you to have push access to this repo, or to a branch, where we could work on this more directly? (I think users can be granted access to specific branches, but i'll need to look up how.)

Sorry for the new hassle!

qdread commented 3 years ago

Well this is a bummer, man. I thought that running the app on the ggalluvial website would require it to be hosted on a server somewhere. But I also tried to display the vignette with vignette('shiny', package = 'ggalluvial'). I thought that would work since the app should run on my local machine. But it didn't work either, the embedded apps did not display. So it seems like we need to fix both those things.

If you want you can give me push access, but for now I might try to create a test repo with embedded app in the vignette to see if I can get it to work that way, then get back in touch if I can figure something out.

corybrunson commented 3 years ago

That sounds fine for now! (I tried to assign this one to both of us earlier; i guess i can't assign someone not in the thread already.) Let me know when i can test it or otherwise be of help. Meanwhile, i'll try to address the remaining issues for the next release, as i should be able to make time now. Thanks so much for sticking with it!

qdread commented 3 years ago

OK I have created a very simple repo to test embedding a Shiny app into a vignette. I am not sure that the recommended methods work anymore. Perhaps there is no longer support for embedding Shiny into RMarkdown?

devtools::install_github('qdread/testShinyVignette')
browseVignettes(package='testShinyVignette')

you can see that there is a static image of the app in the HTML, but no functional app.

I am pretty sure this test repo follows the recommended method. I'm not sure whether I did something wrong or whether the embedding is no longer supported. ☹️ Will ask around about it.

qdread commented 3 years ago

I'd argue we need to either find a server to host the apps, or just say forget it and go back to using screenshots. We can either put the source code at the end of the vignette or link to it.

corybrunson commented 3 years ago

What sort of server would that be? And where in the documentation would it make sense to link to it? (Presumably in the vignette, but asking to be sure.)

Anyway, that sounds like a great plan. It preserves the static quality of the package website and the installed vignettes, and the standalone app is probably a more convenient starting point for people wanting to copy and modify rather than build from scratch.

qdread commented 3 years ago

I just signed up for a free account on shinyapps.io to deploy the two apps. They're now hosted at https://qdread.shinyapps.io/ex-shiny-wide-data/ and https://qdread.shinyapps.io/ex-shiny-long-data/. The free account can host up to 5 apps so that should at least be good for now.

I'll try to figure out the best way to either link to that or embed it in the vignette.

The other thing we should do is just include the actual code used to run the app from the examples directory locally:

shiny::shinyAppDir(system.file("examples/ex-shiny-long-data", package="ggalluvial"))

So people reading the vignette, regardless of if they are reading it locally or on the pkgdown site, can always just copy paste that code and run it locally to see the app.

qdread commented 3 years ago

heyyyyy things are looking good.

Now check out http://quentinread.com/testShinyVignette/articles/testshiny.html. The example ggalluvial app I hosted works there!

It also works locally if you do

devtools::install_github('qdread/testShinyVignette')
browseVignettes(package='testShinyVignette')

The vignette is shown on localhost but has an embedded iframe that runs the app on the shinyapps.io server provided you're connected to the internet!

So that all works. Unfortunately the one thing that does not work is that we still see a blank frame within the RStudio viewer pane when running vignette('testshiny', package = 'testShinyVignette'). So that's too bad. I guess it has to open in a browser to work. If I can figure out a way around that, I will try.

I will work on getting that in the ggalluvial+shiny vignette (ideally I will replace the knitr::include_app with the html it generates so that building the vignette does not require a knitr dependency) and then make a PR! Should have that done sometime this week.

corybrunson commented 3 years ago

Excellent! I'll have to try the installation later on my laptop, but i can confirm the apps work fine on my machine (though the Old Faithful app does not show up). I look forward to the PR!