MattCowgill / ggannotate

Interactively annotate ggplots
Other
309 stars 20 forks source link

Nothing renders in shiny #4

Closed robertwwalker closed 4 years ago

robertwwalker commented 4 years ago

I am attaching a screen shot that should be a reprex of sorts built off of data(VonBort). The shiny starts but the plot is deformed [I think all the plotting is in a tiny splice at the bottom]. If I click anywhere in the box, it crashes. The error is:

Warning: Error in UseMethod: no applicable method for 'ggplot_build' applied to an object of class "function"

The box is Ubuntu 18.04LTS with an almost entirely CRAN package installation. This package is such a great idea, anything that I can do to help I will. Incidentally, I also tried it with

fake.data <- data.frame(x=seq(1,10), y=seq(2,11)) q <- ggplot(fake.data) + aes(x=x, y=y) + geom_point() ggannotate:::ggannotate(q)

And get the same behavior.

gganotate

Apologies for my bad choice of screen shot apps. I really should look for a better one.

MattCowgill commented 4 years ago

Hi @robertwwalker thanks very much for filing this issue and sorry about this problem. I'll try to figure out what is causing it and fix it as soon as I can.

MattCowgill commented 4 years ago

Your example doesn't work for me either (on macOS). But it does work when I highlight the plot code and then invoke the Shiny app via the RStudio add-ins menu. Weird. Does that work for you? I'll try and figure out what's going on

robertwwalker commented 4 years ago

That solved it for both. Thanks very much.

Sent from Mailspring (https://getmailspring.com/), the best free email app for work On Feb 17 2020, at 2:32 pm, Matt Cowgill notifications@github.com wrote:

Your example doesn't work for me either (on macOS). But it does work when I highlight the plot code and then invoke the Shiny app via the RStudio add-ins menu. Weird. Does that work for you? I'll try and figure out what's going on

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub (https://github.com/MattCowgill/ggannotate/issues/4?email_source=notifications&email_token=AFOFUOF4LWVKT67NDO2DN43RDMGBRA5CNFSM4KWXBSHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL72JUA#issuecomment-587179216), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AFOFUOET6IXLQNL53HVHVATRDMGBRANCNFSM4KWXBSHA).

robertwwalker commented 4 years ago

For what it is worth, I got to the nonworking approach from the example in the readme.md that passes a stored plot. Has that ever worked? I tried it on a windows machine to the same effect.

As a friendly and immediate fix, perhaps just a slight modification to the readme.md that doesn't imply this and then a future feature?

I played with some eval and other things to try to work around it but couldn't figure it out in the time I spent on it. By the way, this is absolutely amazing for R learners that want to be able to create enterprise quality graphics in ggplot without having learned that much R. In fact, between esquisse and this, I think much of the ggplotverse becomes available with almost no knowledge of the language and that is really great for R educators. Get wins early!

MattCowgill commented 4 years ago

Thanks @robertwwalker! Good idea, I'll amend the README and keep working to fix this problem. Yes, the example in the README works.

robertwwalker commented 4 years ago

Interesting. The example in the readme.md does not work for me in exactly the same way. Sent from Mailspring (https://getmailspring.com/), the best free email app for work

On Feb 17 2020, at 4:08 pm, Matt Cowgill notifications@github.com wrote:

Thanks @robertwwalker (https://github.com/robertwwalker)! Good idea, I'll amend the README and keep working to fix this problem. Yes, the example in the README works.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub (https://github.com/MattCowgill/ggannotate/issues/4?email_source=notifications&email_token=AFOFUOEBNASYGUXTE4KNRETRDMRGNA5CNFSM4KWXBSHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMAB2OY#issuecomment-587210043), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AFOFUOCTAV6D7GMLHGCKRBTRDMRGNANCNFSM4KWXBSHA).

MattCowgill commented 4 years ago

Thanks again for raising this issue @robertwwalker. I've made some changes (pushed to dev branch) that mean it is now working for me when I select code in RStudio, or when I wrap code in ggannotate(), as in ggannotate(ggplot(fake.data) + aes(x=x, y=y) + geom_point()), or when I create a ggplot2 object then pass that object to ggannotate (as in the example above that was not working previously).

robertwwalker commented 4 years ago

Thank you so much! This is a very cool tool for the classroom because it allows wins early. Love it!

On Fri, Feb 21, 2020, 19:09 Matt Cowgill <notifications@github.com (mailto:notifications@github.com)> wrote:

Thanks again for raising this issue @robertwwalker (https://github.com/robertwwalker). I've made some changes (pushed to dev branch) that mean it is now working for me when I select code in RStudio, or when I wrap code in ggannotate(), as in ggannotate(ggplot(fake.data) + aes(x=x, y=y) + geom_point()), or when I create a ggplot2 object then pass that object to ggannotate (as in the example above that was not working previously).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub (https://github.com/MattCowgill/ggannotate/issues/4?email_source=notifications&email_token=AFOFUOHQKEKPATX4YXR3OZ3RECJOVA5CNFSM4KWXBSHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMUVKWI#issuecomment-589911385), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AFOFUODATD3WMNW7AH4R5GLRECJOVANCNFSM4KWXBSHA).