# NOT RUN {
require( ggplot2 )
# Add a base plot
doc = addPlot( doc = doc, fun = plot
, x = rnorm( 100 )
, y = rnorm (100 )
, main = "base plot main title"
)
## Add a ggplot2
myplot = qplot(Sepal.Length, Petal.Length, data = iris, color = Species
, size = Petal.Width, alpha = I(0.7))
doc = addPlot( doc = doc
, fun = print
, x = myplot #this argument MUST be named, print is expecting argument 'x'
)
## Add a ggplot2 and another plot
doc = addPlot( doc = doc
, fun = function(){
print( qplot(Sepal.Length, Petal.Length, data = iris, color = Species
, size = Petal.Width, alpha = I(0.7)) )
plot(x = rnorm( 100 ), y = rnorm (100 ), main = "base plot main title")
}
)
# }
Run the code above in your browser using DataCamp Workspace