GithubHelp home page GithubHelp logo

dataxujing / ggedit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yonicd/ggedit

0.0 1.0 0.0 38.36 MB

Interactively edit ggplot layer aesthetics and theme definitions

HTML 96.07% JavaScript 0.73% CSS 0.06% R 3.10% Makefile 0.01% TeX 0.04%

ggedit's Introduction

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

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://metrumresearchgroup.github.io/ggedit/

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

User Lightning Talks โ€“ 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

devtools::install_github("metrumresearchgroup/ggedit")

DEV updates ggedit_0.2.2

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

  • functionality added

    • 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, \n24.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)

example plot

plot <- 
  iris%>%
  ggplot(aes(x=cut(Sepal.Width,2),y=Sepal.Width)) +
  aes(colour=Species,group=Species)+
  geom_point(alpha = 0.5,shape = 16, size = 1) +
  geom_boxplot(aes(group=NULL), varwidth = FALSE,notch = FALSE, show.legend = TRUE)+
  stat_summary(fun.y = 'median', geom = "line")+
  theme_bw(base_size = 16) +
  theme(legend.position = "bottom",
        legend.box = "vertical", legend.direction = "horizontal",
        axis.text.x = ggplot2::element_text(angle = 90,hjust = 1, vjust = 0.5),
        legend.title = element_blank())

ggedit(plot)

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
  • theme
    • margin,arrow are not currently available to edit

ggedit's People

Contributors

yonicd avatar talgalili avatar jcheng5 avatar

Watchers

James Cloos avatar

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.