Interactive 'ggplot2' Layer and Theme Aesthetic Editor

Interactively edit 'ggplot2' layer and theme aesthetics definitions.

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

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:

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

User Lightning Talks – RStudio




For a quick example, run the following:

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)




  • 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





Collapse internal files to run the module and gadget from same base script.

Reorganize BS Modals to have columns by object type.

Change plot.ggedit be a print.ggedit method.

shinyBS js library dependencies loaded with package, this lets ggedit run on attachment. i.e. ggedit::ggedit(p)


margins can be edited in the theme UI functionality added to gglist class to manipulate to multiple plots in layout

as.gglist(list(pList[[1]],pList[[3]])) + 
  geom_hline(yintercept=3:4,linetype=2) + 
  theme(legend.position = 'top')

gg_session retreives all functions that create ggroto layers or stats in current loaded namespace and returns unique mapping to their position,geom,stat.


gg_vetting returns the columns from gg_session relevant to a compiled plot


ggedit_opts functionality to control session levels options (like knitr::opts_chunk). This can be used to manipulate the package defaults like the theme tips seen in BS modals. It is also used to store an updated output of gg_session, so ggedit can identify the correct mapping with gg_extension pacakges (eg ggalt).


manipulate gg_extension pacakges (still in development, but works for a lot of the ggplot2 extension packages)

dput.ggedit returns dput for ggplot2 object in script form and not a structure.

pList$pointSmooth #original compiled plot <- dput.ggedit(pList$pointSmooth) #dput the plot
writeLines( #show the output
eval(parse( #recompile the plot

summary.ggedit method for ggedit class return script that created compiled gg object.

out <- ggedit(pList[1:2])
#assuming out is returned from ggedit
# point
# ggplot(mapping=aes(x=Sepal.Length,y=Sepal.Width),[data.frame])+
# geom_point(aes(colour=Species),size=6)
# pointWrap
# ggplot(mapping=aes(x=Sepal.Length,y=Sepal.Width),[data.frame])+
# geom_point(aes(colour=Species),size=6)+
# facet_wrap(facets=~Species,shrink=TRUE)



  • Change mutate_each with mutate_all to be compatible with new dplyr release


- can pass functions into stat_summary, eg `stat_summary(fun.y=mean_sd, geom='point')`
- data.frames in layers are embedded as structures in verbose outputs, e.g. `geom_point(data=mtcars, aes(cyl, mpg))` will return
[1] "geom_point(mapping=aes(x=cyl,y=mpg), data=structure(list(mpg = c(21, 21, 22.8, 21.4, 18.7, 18.1, 14.3,
24.4, 22.8, 19.2, 17.8, 16.4, 17.3, 15.2, 10.4, 10.4, 14.7, 32.4,.. <truncated>
- aesthetic can be set to NULL, ie aes(group=NULL)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.3.0 by Jonathan Sidi, 2 years ago

Report a bug at

Browse source code at

Authors: Jonathan Sidi [aut, cre]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports dplyr, plyr, tidyr, purrr, rlang, scales, rstudioapi, shiny, miniUI, shinyBS, colourpicker, shinyAce, magrittr, utils, graphics, grid, tools, stats

Depends on ggplot2

Suggests testthat, covr

See at CRAN