GithubHelp home page GithubHelp logo

yonicd / ggedit Goto Github PK

View Code? Open in Web Editor NEW
245.0 22.0 29.0 38.93 MB

Interactively edit ggplot layer aesthetics and theme definitions

Home Page: https://yonicd.github.io/ggedit/

License: Other

JavaScript 0.71% CSS 0.06% HTML 96.14% R 3.05% Makefile 0.01% TeX 0.04%
shiny ggplot2 r

ggedit's Introduction

CRAN_Status_Badge Project Status: Active - The project has reached a stable, usable state and is being actively developed. downloadsCoverage StatusCovrpage Summary

ggedit

ggplot2 has become the standard of plotting in R for many users. New users, however, may find the learning curve steep at first, and more experienced users may find it challenging to keep track of all the options (especially in the theme!).

ggedit is a package that helps users bridge the gap between making a plot and getting all of those pesky plot aesthetics just right, all while keeping everything portable for further research and collaboration.

ggedit is powered by a Shiny gadget where the user inputs a ggplot plot object or a list of ggplot objects. You can run ggedit directly from the console or from the Addin menu within RStudio.

Online User Manual Gitbook

A gitbook is maintained as the user manual for the package, you can access it here:

https://yonicd.github.io/ggedit/

Short clip from rstudio::conf 2017 (13:35-19:35)

Lightning Talks - Users - RStudio

Installation

CRAN

install.packages('ggedit')

For a quick example, run the following:

library('ggedit')
library(ggplot2)
p <- ggplot(mtcars, aes(x = hp, y = wt)) + geom_point() + geom_smooth()
p2 <- ggedit(p)
names(p2) # will show you which objects are available.
plot(p2) # shows the updated plot (it is available in the first element of p2)

DEV

remotes::install_github("yonicd/ggedit")

Limitations

  • layers
    • non colour aesthetics of numeric inputs are not currently supported, e.g.:

      iris |> 
        ggplot(aes(x = Sepal.Length, y = Sepal.Width)) +
        geom_point() + 
        geom_text(aes(label = Species, size = Sepal.Length))
      
    • geom_text: family is not currently open to change

ggedit's People

Contributors

jcheng5 avatar romainfrancois avatar talgalili avatar yonicd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ggedit's Issues

dput.ggedit - reproduce the code to create the plot

For example. if my first code is:

library(ggplot2)
library(ggedit)
p <- ggplot(mtcars, aes(x = hp, y = wt)) + geom_point() + geom_smooth()
p2 <- ggedit(p)

I want to run:

dput.ggedit(p2)

And to see the new code I'll need to run in order to reproduce the final output I got to through the ggedit workflow.

For example:

dput.ggedit(p2)
[1] "ggplot(mtcars, aes(x = hp, y = wt)) + geom_point(shape=9,colour='#B03131',size=5) + geom_smooth()"

Notice that the code should not include the default parameters (so it is as short as possible). You may also include the full range of parameters and defaults as an option (but the default should be to NOT show them).

"View Layer Code" add option to not show default parameters

When using ggedit, if I run:

library(ggplot2)
library(ggedit)
p <- ggplot(mtcars, aes(x = hp, y = wt)) + geom_point() + geom_smooth()
p2 <- ggedit(p)

It says my original layer call was:

"geom_point(mapping=NULL,na.rm=FALSE,data=NULL,position=\"identity\",stat=\"identity\",show.legend=NA,inherit.aes=TRUE)"

This is not true, it was:

"geom_point()"

Add the option to omit all the default parameters so that the user can more easily see what was changed (especially in Windows where the code is not colored).

split_chain not found

Hello,
Thank you for creating such a brilliant tool, but unfortunately I haven't been able to use it because it says
Error in split_chain(match.call(), env = env) :
could not find function "split_chain"
every time I start it from commandline or the add-ins menu.

I have ggplot2v3.3.3, Rv.4.0.5 on Mac OS Big Sur 11.2.3. Also in case relevant, magrittr 2.0.1.

I do hope this is still being maintained, it'd be an extraordinarily useful tool if only I can get it working!

Thanks again,
Reubs

Failures when calling ggedit::ggedit() without attaching the package

library(ggplot2)
p <- ggplot(mpg) + geom_bar(aes(x = class))
ggedit::ggedit(p)


Warning: Error in if: argument is of length zero
Stack trace (innermost first):
    102: shiny::renderPlot [/tmp/Rtmp2s9CU6/R.INSTALL1b12402fb480/ggedit/R/ggeditGadget.R#219]
     92: <reactive:plotObj>
     81: plotObj
     80: origRenderFunc
     79: output$Plot
      4: shiny::runApp
      3: shiny::runGadget
      2: ggeditGadget [/tmp/Rtmp2s9CU6/R.INSTALL1b12402fb480/ggedit/R/ggeditGadget.R#338]
      1: ggedit::ggedit [/tmp/Rtmp2s9CU6/R.INSTALL1b12402fb480/ggedit/R/ggedit.R#125]

Error: attempt to select less than one element in OneIndex

Great work on ggedit! I was trying to see how I could use it to add and remove layers from a plot but keep getting stuck on this message:

Error in p$labels[[names(layers[[a.rm]]$mapping)]] <- NULL : attempt to select less than one element in OneIndex

Suppose I have the plot below. I get new code using the ggedit shiny app (2nd line). Now I have 2 geom_point layers and I want to remove the "old" one using remove_geom but that doesn't work as I expected

p <- ggplot(mtcars, aes(x = cyl, y = mpg)) + geom_point()
p <- p + geom_point(shape=8,colour='#000000',size=1.5,fill='#FFFFFF',alpha=1,stroke=4)
p %>% remove_geom("point", 1)

By the way, I using the pipe operator in my own code extensively but it does looks inconsistent with the + used by ggplot. Is it feasible to add + as an operator (and perhaps - as well)?

Error when running example 'magrittr_pipe' not found

Hi ,

when I run the example below, I get the following error - any ideas how to solve it? I don't have this problem using the pipe in any other package?

Thanks

Adam

 library('ggedit')
 library(ggplot2)
 p <- ggplot(mtcars, aes(x = hp, y = wt)) + geom_point() + geom_smooth()
 p2 <- ggedit(p)

Listening on http://127.0.0.1:3926
Warning: Error in %>%: object 'magrittr_pipe' not found
56: %>%
55: cloneLayer
54: FUN
53: lapply
52: FUN
51: lapply
50: server
Error in proto_features(l) %>% dplyr::left_join(geom_opts %>% dplyr::filter(!grepl("^stat", :
object 'magrittr_pipe' not found

colourpicker error

Hello, I must be doing something silly, trying to install using devtools I get:

ERROR: dependency 'colourpicker' is not available for package 'ggedit'

I have the ggextra package installed, I tried searching for a colourpicker package for R but have not found anything.

Add width/height parameters to ggedit

Currently, if I edit a plot I will not know how the new parameters will look like in the place I am likely to display the plot. For example, choosing size=2 or size=5 depends on the width/height of the final graphic device in which I plan to display the figure.
Adding these parameters to ggedit, will make sure that when I edit the plot, I will see it in the editor the way I plan to have it later on.
This can also be a field in the shiny app, and/or a parameter in ggedit itself.

Can't use ggedit(): R Session aborted in Windows 10PC

Code:

require(ggplot2)
require(ggedit)
p=ggplot(iris,aes(x =Sepal.Length,y=Sepal.Width))
p=p+geom_point(aes(colour=Species))+geom_line()
p

Crashes at this stage. Session info shown before this.

x=ggedit(p)

Device:

Windows 10 laptop

Session Info

sessionInfo()
R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_India.1252 LC_CTYPE=English_India.1252
[3] LC_MONETARY=English_India.1252 LC_NUMERIC=C
[5] LC_TIME=English_India.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base

other attached packages:
[1] ggedit_0.2.6 ggplot2_2.2.1

loaded via a namespace (and not attached):
[1] Rcpp_0.12.13 bindr_0.1 magrittr_1.5
[4] munsell_0.4.3 colorspace_1.3-2 xtable_1.8-2
[7] R6_2.2.2 rlang_0.1.2 stringr_1.2.0
[10] plyr_1.8.4 dplyr_0.7.4 tools_3.4.2
[13] grid_3.4.2 shinyAce_0.2.1 gtable_0.2.0
[16] miniUI_0.1.1 htmltools_0.3.6 lazyeval_0.2.0
[19] assertthat_0.2.0 digest_0.6.12 tibble_1.3.4
[22] bindrcpp_0.2 shiny_1.0.5 reshape2_1.4.2
[25] glue_1.1.1 mime_0.5 labeling_0.3
[28] stringi_1.1.5 compiler_3.4.2 shinyBS_0.61
[31] scales_0.5.0 httpuv_1.3.5 pkgconfig_2.0.1

error- ggedit

Crashes on launch

Read about this package in r-bloggers and wanted to try it out. Got a crash on the following code:

library(dplyr)
library(rjson)

flatten_nodes <- function(root) {
    nd <- get_node_data(root)
    class(nd) <- "node"
    if("children" %in% names(root)) {
        res <- vector(mode = "list", length = length(root[["children"]]))
        for(i in 1:length(res)) {
            res[[i]] <- flatten_nodes(root[["children"]][[i]])
        }
        if(!all(sapply(res,function(z)inherits(z,"node")))) res <- do.call("c",res)
    } else res <- NULL
    return(c(list(nd),res))
}

tr1 <- rjson::fromJSON(file =" treemap.txt")

zz2 <- flatten_nodes(tr1) %>% bind_rows %>% mutate(Color = ifelse(is.na(Color),"#53889A",Color))


ggplot(zz2,aes(xmin = x0, xmax=x1, ymin=-y0, ymax=-y1)) +
    geom_rect(aes(fill = Color))+
    scale_fill_manual(values=na.omit(sort(unique(zz2$Color))))+
    theme_void() + theme(legend.position = "blank")

I've added the json treemap.txt

The error I get is

Warning in if (class(p$data) != "waiver") mapping_class = lapply(train_map(p),  :
  la condition a une longueur > 1 et seul le premier élément est utilisé
Warning: Error in $<-.data.frame: replacement has 3 rows, data has 1
Stack trace (innermost first):

My devtools::session_info()

> devtools::session_info()
Session info ---------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.3.0 (2016-05-03)
 system   x86_64, darwin13.4.0        
 ui       RStudio (1.0.136)           
 language (EN)                        
 collate  fr_FR.UTF-8                 
 tz       Europe/Vilnius              
 date     2017-02-28                  

Packages -------------------------------------------------------------------------------------
 package            * version  date       source                                     
 assertthat           0.1      2013-12-06 CRAN (R 3.3.0)                             
 base64enc            0.1-3    2015-07-28 CRAN (R 3.3.0)                             
 colorspace           1.2-6    2015-03-11 CRAN (R 3.3.0)                             
 colourpicker       * 0.3      2016-12-05 cran (@0.3)                                
 crayon               1.3.2    2016-06-28 CRAN (R 3.3.0)                             
 curl                 0.9.7    2016-04-10 CRAN (R 3.3.0)                             
 data.table           1.10.0   2016-12-03 cran (@1.10.0)                             
 DBI                  0.5-1    2016-09-10 cran (@0.5-1)                              
 devtools             1.12.0   2016-06-24 CRAN (R 3.3.0)                             
 digest               0.6.12   2017-01-27 cran (@0.6.12)                             
 dplyr              * 0.5.0    2016-06-24 CRAN (R 3.3.0)                             
 ggedit             * 0.1.1    2017-02-28 Github (metrumresearchgroup/ggedit@2056463)
 ggplot2            * 2.2.1    2016-12-30 CRAN (R 3.3.2)                             
 git2r                0.15.0   2016-05-11 CRAN (R 3.3.0)                             
 gridExtra          * 2.2.1    2016-02-29 CRAN (R 3.3.0)                             
 gtable               0.2.0    2016-02-26 CRAN (R 3.3.0)                             
 htmltools            0.3.5    2016-03-21 CRAN (R 3.3.0)                             
 htmlwidgets          0.8      2016-11-09 cran (@0.8)                                
 httpuv               1.3.3    2015-08-04 CRAN (R 3.3.0)                             
 httr                 1.2.1    2016-07-03 CRAN (R 3.3.0)                             
 jsonlite             1.2      2016-12-31 cran (@1.2)                                
 labeling             0.3      2014-08-23 CRAN (R 3.3.0)                             
 lazyeval             0.2.0    2016-06-12 CRAN (R 3.3.0)                             
 magrittr             1.5      2014-11-22 CRAN (R 3.3.0)                             
 memoise              1.0.0    2016-01-29 CRAN (R 3.3.0)                             
 mime                 0.5      2016-07-07 CRAN (R 3.3.0)                             
 miniUI             * 0.1.1    2016-01-15 CRAN (R 3.3.0)                             
 munsell              0.4.3    2016-02-13 CRAN (R 3.3.0)                             
 plotly             * 4.5.6    2016-11-12 cran (@4.5.6)                              
 plyr               * 1.8.4    2016-06-08 CRAN (R 3.3.0)                             
 purrr                0.2.2    2016-06-18 CRAN (R 3.3.0)                             
 R6                   2.2.0    2016-10-05 cran (@2.2.0)                              
 Rcpp                 0.12.9.3 2017-02-28 Github (RcppCore/Rcpp@c76a5c3)             
 reshape2           * 1.4.2    2016-10-22 cran (@1.4.2)                              
 rjson                0.2.15   2014-11-03 CRAN (R 3.3.0)                             
 RMySQL               0.10.9   2016-05-08 CRAN (R 3.3.0)                             
 roxygen2             5.0.1    2015-11-11 CRAN (R 3.3.0)                             
 rstudioapi           0.6      2016-06-27 CRAN (R 3.3.0)                             
 scales             * 0.4.1    2016-11-09 cran (@0.4.1)                              
 shiny              * 1.0.0    2017-01-12 cran (@1.0.0)                              
 shinyAce           * 0.2.1    2016-03-14 cran (@0.2.1)                              
 shinyBS            * 0.61     2015-03-31 CRAN (R 3.3.0)                             
 stringi              1.1.2    2016-10-01 cran (@1.1.2)                              
 stringr              1.2.0    2017-02-18 cran (@1.2.0)                              
 testthat             1.0.2    2016-04-23 CRAN (R 3.3.0)                             
 tibble               1.2      2016-08-26 cran (@1.2)                                
 tidyr                0.6.1    2017-01-10 cran (@0.6.1)                              
 TTdashboardDev0227 * 0.2.27   <NA>       local                                      
 viridisLite          0.1.3    2016-03-12 cran (@0.1.3)                              
 withr                1.0.2    2016-06-20 CRAN (R 3.3.0)                             
 xtable               1.8-2    2016-02-05 CRAN (R 3.3.0)      

Work with ' instead of "

This way to code in the "View Layer Code" wouldn't need to use:
stat="identity"
instead of just:
stat="identity"

Failed to install 'unknown package' from GitHub

Error: Failed to install 'unknown package' from GitHub:
HTTP error 404.
Not Found

Did you spell the repo owner and repo name correctly?

  • If spelling is correct, check that you have the required permissions to access the repo.

plotly::ggplotly support

Great work!
It would be awesome to be able to output the edited plot to ggplotly.

e.g. quick and dirty hack of the plot.ggedit

library(ggedit)
library(ggplot2)
library(dplyr)
library(plotly) # * 3.6.0

get_ggedit<-function(obj){
  if(!is.null(obj$UpdatedPlots)) obj=obj$UpdatedPlots
  numPlots = length(obj)
  pp<-obj[[1]]
  if(length(obj)>1){
    for (i in 2:numPlots) {
      pp<-pp + obj[[i]]
    } 
  }
  return(pp)
}

p<-ggplot(data=iris,aes(x =Sepal.Length,y=Sepal.Width))+
  geom_point(aes(color=Species),size=6) 

ggedit(p) %>% 
  get_ggedit(.) %>%
  ggplotly(.)

View Layer Code

Thank you for your help in diagnosing my prior issue report. Editing the ggplot code as you suggested eliminated the issue. The current issue is happening on my Windows laptop; it was not reproducible on my mac. Once a change has been made to a plot within ggedit, clicking the "View Layer Code" option expands the gray box that should contain the updated code, but the code is not displaying. No errors are visibly generated.

Sample Code:

#data
graph.data <- data.frame(factor=c("First", "Second", "Third"), response=rnorm(n=3, mean=50, sd=25))
SEhigh.temp <- graph.data$response+c(2, 4, 5)
SElow.temp <- graph.data$response-c(2, 4, 5)
graph.data$SEhigh <- SEhigh.temp
graph.data$SElow <- SElow.temp
remove(SEhigh.temp, SElow.temp)
#Graph
ggplot(graph.data, aes(x=factor)) +
  geom_bar(stat="identity", aes(y=response)) +
  geom_errorbar(aes(ymin=SElow, ymax=SEhigh), width=0.25)

sessionInfo():

R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] ggedit_0.0.2     miniUI_0.1.1     dplyr_0.5.0      colourpicker_0.3 plyr_1.8.4      
 [6] plotly_4.5.6     ggplot2_2.2.1    scales_0.4.1     gridExtra_2.2.1  reshape2_1.4.2  
[11] shinyBS_0.61     shinyAce_0.2.1   shiny_1.0.0     

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.9       base64enc_0.1-3   tools_3.3.2       digest_0.6.12     jsonlite_1.2     
 [6] tibble_1.2        gtable_0.2.0      viridisLite_0.1.3 DBI_0.5-1         rstudioapi_0.6   
[11] stringr_1.1.0     httr_1.2.1        htmlwidgets_0.8   R6_2.2.0          purrr_0.2.2      
[16] tidyr_0.6.1       magrittr_1.5      htmltools_0.3.5   assertthat_0.1    mime_0.5         
[21] xtable_1.8-2      colorspace_1.3-2  httpuv_1.3.3      labeling_0.3      stringi_1.1.2    
[26] lazyeval_0.2.0    munsell_0.4.3    

ggedit

Error when building package in R 4.0.0

Error message when trying to install the latest CRAN version (0.4.0) on R 4.0.0:

* installing *source* package ‘ggedit’ ...
** package ‘ggedit’ successfully unpacked and MD5 sums checked
** using staged installation
** R
Error in parse(outFile) : 
/tmp/RtmpHCmjNQ/R.INSTALLa2cb3ded0447/ggedit/R/class_layer.R:32:21: unexpected '>'
31:     
32:     TEMP <- p$data |>
                         ^
ERROR: unable to collate and parse R files for package ‘ggedit’

It looks like the native R pipe operator is used in this code, but that wasn't added until R4.1.

Compatibility with ggplot2 3.5.0

Hello there,

We have been preparing a new release of ggplot2 and during a reverse dependency check, and it seemed ggedit's checks failed. I tried to reproduce this locally, and it seems to occur both with the current CRAN version and the upcoming version of ggplot2.

The problem appears to originate in R/clone_facet.R, where it seems that some of the assumptions have become outdated. The new ggplot2 version adds two additional arguments to both facet_wrap() and facet_grid().

If you'd like to test yourself against ggplot2's release candidate, you can install it with the code below:

remotes::install_github("tidyverse/ggplot2", ref = remotes::github_pull("5592"))

The release of ggplot2 3.5.0 is scheduled for the 12th of February. The progress of the release can be tracked in tidyverse/ggplot2#5588. We hope to have informed you in a timely manner about upcoming changes.

Error: undefined columns selected

Code used to produce the error:

#data
  graph.data <- data.frame(factor=c("First", "Second", "Third"), response=rnorm(n=3, mean=50, sd=25))
  SEhigh.temp <- graph.data$response+c(2, 4, 5)
  SElow.temp <- graph.data$response-c(2, 4, 5)
  graph.data$SEhigh <- SEhigh.temp
  graph.data$SElow <- SElow.temp
  remove(SEhigh.temp, SElow.temp)
#Graph
  ggplot(graph.data, aes(x=factor)) +
    geom_bar(stat="identity", aes(y=response)) +
    geom_errorbar(aes(ymin=SElow, ymax=SEhigh, width=0.25))

From the console:

Listening on http://127.0.0.1:6843
Warning: Error in [.data.frame: undefined columns selected
Stack trace (innermost first):
    91: [.data.frame
    90: [
    89: FUN
    88: lapply
    87: sapply
    86: FUN
    85: lapply
    84: fetch_aes_ggplotBuild
    83: renderUI
    82: func
    81: origRenderFunc
    80: output$popElems
     5: shiny::runApp
     4: runGadget
     3: ggeditGadget
     2: ggedit
     1: ggedit:::ggeditAddin

sessionInfo()

R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.1

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] multcompView_0.1-7 multcomp_1.4-6     TH.data_1.0-8      MASS_7.3-45        survival_2.40-1    mvtnorm_1.0-5      ggedit_0.0.2      
 [8] miniUI_0.1.1       dplyr_0.5.0        colourpicker_0.3   plyr_1.8.4         plotly_4.5.6       ggplot2_2.2.1      scales_0.4.1      
[15] gridExtra_2.2.1    reshape2_1.4.2     shinyBS_0.61       shinyAce_0.2.1     shiny_1.0.0       

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.9       base64enc_0.1-3   tools_3.3.2       digest_0.6.12     lattice_0.20-34   jsonlite_1.2      tibble_1.2        gtable_0.2.0     
 [9] viridisLite_0.1.3 Matrix_1.2-8      rstudioapi_0.6    DBI_0.5-1         stringr_1.1.0     httr_1.2.1        htmlwidgets_0.8   R6_2.2.0         
[17] purrr_0.2.2       tidyr_0.6.1       magrittr_1.5      codetools_0.2-15  splines_3.3.2     htmltools_0.3.5   assertthat_0.1    mime_0.5         
[25] xtable_1.8-2      colorspace_1.3-2  httpuv_1.3.3      labeling_0.3      sandwich_2.3-4    stringi_1.1.2     lazyeval_0.2.0    munsell_0.4.3    
[33] zoo_1.7-14       

screen shot 2017-01-30 at 1 03 37 pm

From the screen posted above, clicking "update plot error produces:

Warning: Error in if: argument is of length zero
Stack trace (innermost first):
    103: renderPlot
     93: <reactive:plotObj>
     82: plotObj
     81: origRenderFunc
     80: output$Plot
      5: shiny::runApp
      4: runGadget
      3: ggeditGadget
      2: ggedit
      1: ggedit:::ggeditAddin

screen shot 2017-01-30 at 1 12 00 pm

Installation Fails

I am trying to install this tool and I run into failures to load ggedit.

Can anyone give any advice? I am on the latest version of R and RStudio.

image

Allow user to specify title, legend, axes, footnote text

Thanks for developing ggedit. I wonder if it would be possible to allow users to update / specify title, legend, axes and footnote text with ggedit? That way, the analyst could provide the basic plot object, which can be QCed in advance and "locked down" independently of changes to the surrounding text. I'm thinking of cases where the analyst produces a "quick and dirty" graph for their own use / review, but subsequently the only thing that changes in later revisions for inclusion in reports is the surrounding textual elements and "style" / theme attributes that you have covered already via ggedit.

Using ggedit inside a typical shiny app?

I'm extremely impressed with ggedit and it's already reduced my time in making quality plots with ggplot2! I make quite a few Shiny apps that produce graphics with ggplot2, and in the past I would add some custom inputs for details like font size, axis labels, line size, point size, you get the idea. But it would be very convenient if I could somehow embed ggedit inside the app so that they could click a simple action button to invoke the ggedit interface, or even just embed the interface inside a tabPanel in shiny. Admittedly I have not tried this out in practice, but I was curious if ggedit has a way to do this in a seamless fashion.

Error Running ggedit()

When running the following code I receive an following error:

library(ggplot2)
p <- ggplot(mpg, aes(displ, hwy)) + geom_point()
p2 <- ggedit(p)

Listening on http://127.0.0.1:7542
Warning: Error in $<-.data.frame: replacement has 3 rows, data has 2
Stack trace (innermost first):
    86: $<-.data.frame
    85: $<-
    84: class_layer
    83: fetch_aes_ggplotBuild
    82: renderUI
    81: func
    80: origRenderFunc
    79: output$popElems
     4: shiny::runApp
     3: runGadget
     2: ggeditGadget
     1: ggedit
> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] ggedit_0.0.1     miniUI_0.1.1     dplyr_0.5.0      colourpicker_0.3 plyr_1.8.4       scales_0.4.1    
 [7] gridExtra_2.2.1  reshape2_1.4.2   shinyBS_0.61     shiny_0.14.2     ggplot2_2.2.0   

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.8        tools_3.3.0        digest_0.6.10      jsonlite_1.1       tibble_1.2        
 [6] nlme_3.1-127       gtable_0.2.0       lattice_0.20-33    psych_1.6.9        rstudioapi_0.5    
[11] DBI_0.5-1          parallel_3.3.0     haven_1.0.0        stringr_1.1.0      htmlwidgets_0.8   
[16] sjmisc_2.1.0       R6_2.2.0           foreign_0.8-66     tidyr_0.6.0        purrr_0.2.2       
[21] magrittr_1.5       htmltools_0.3.5    stringdist_0.9.4.1 assertthat_0.1     mnormt_1.5-4      
[26] mime_0.5           colorspace_1.3-1   xtable_1.8-2       httpuv_1.3.3       labeling_0.3      
[31] stringi_1.1.2      lazyeval_0.2.0     munsell_0.4.3      broom_0.4.1       

ggedit v0.2.1 : interaction in Shiny web app' ?

Hi everyone,

I am interested in implementing an interactive ggplot2 editor, such as the one proposed by Yoni's package ‘ggedit’, in a Shiny web application.
Do you know if there is a way to pass to callModule(ggEdit, …) an object that is already in a reactive context ?
In practice, I would like to use as the default ggplot for ggEdit, the graphics which has been created/edited by the user via one or several input parameters (e.g: station, pollutants, time period, ...)

In the present example: ui side numericInput(“alpha”) --> input$alpha --> server side p1.react <- reactive({ggplot(…) + geom_point(alpha = input$alpha)}).
Observation : because p1.react() is not a ggplot2 object, it cannot be edited by ggEdit as expected…

Please find in attachment, the Shiny app’ (actually, I ran the source code from Yoni R-bloggers’ post “ggedit 0.1.1: Shiny module to interactvely edit ggplots within Shiny applications”
and added few lines of code) used to test this behavior.
Any clue is welcome.

With kind regards,

Laurent
app.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.