Learn R Programming

ggedit (version 0.4.1)

dput.ggedit: Convert ggplot object to a string call

Description

Convert ggplot object to a string call

Usage

dput.ggedit(obj, file = "")

Value

character

Arguments

obj

compiled ggplot object

file

either a character string naming a file or a connection. " " indicates output to the console, Default: " "

Examples

Run this code

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

 #add theme change
 p <- pList$pointSmooth+theme(panel.background = element_rect(fill='green'))
 
 this.gg<-dput.ggedit(p) #dput the plot
 
 writeLines(this.gg) #show the output
 
 eval(parse(text=this.gg)) #recompile the plot

Run the code above in your browser using DataLab