Open erge19736 opened 8 years ago
As a side note, if ggThemeAssistGadget(plot) is run in an older R Studio version, after clicking "Done" in the gadget, this error is produced:
Warning: Error in : Function insertText not found in RStudio
Stack trace (innermost first):
68: callFun
67: rstudioapi::insertText
66: observeEventHandler
4: shiny::runApp
3: runGadget
2: ggThemeAssist
1: ggThemeAssistGadget
When run in R, the following error is produced:
Warning: Error in : RStudio not running
Stack trace (innermost first):
69: verifyAvailable
68: callFun
67: rstudioapi::insertText
66: observeEventHandler
4: shiny::runApp
3: runGadget
2: ggThemeAssist
1: ggThemeAssistGadget
Package ggThemeAssist version 0.1.4
Thanks for your message. Yes, we are aware of that and indeed PR #47 would implement such a feature.
We will probably regard this feature in the next minor update.
Ok, I've made some adjustments, let me know what you think:
> library(ggplot2)
> data(mtcars)
> gg <- ggplot(mtcars, aes(mpg, hp)) + geom_point()
> x <- ggThemeAssistGadget(gg)
> # Addin should open in your browser
> # Make your changes and click 'Done'
> x
[1] "gg <- gg + theme(plot.background = element_rect(fill = \"blue\"))"
> eval(parse(text = x)) # overwrites the object 'gg'
To try this yourself, install the 'console'-branch:
devtools::install_github("calligross/ggthemeassist", ref = "console")
Make sure that this is some kind of showcase. I have not tested much, so please report any strange behaviour.
I didn't have an opportunity to test it extensively but it does seem to work now! Thank you!
I don't have admin privileges to update my R Studio and some of my colleagues have R but not R Studio. Could you please add a way to turn it into a function that can be run without having to install R Studio?
Perhaps something like the pull request at https://github.com/calligross/ggthemeassist/pull/47 could work?
Thanks!