cbarbu / R-package-zoom

An R package to zoom in and out and more generally navigate a plot or a group of plots in R.
GNU Lesser General Public License v3.0
5 stars 1 forks source link

navigationg ggplot2 #3

Open cbarbu opened 11 years ago

cbarbu commented 11 years ago

ggplot2 uses it's own graphics tricks and it would take a bit of work to adapt (but should fix at the same time session and navigation)

It replayPlot fine but the use of do.call is messed up: Error in do.call(fn, alst) : could not find function "drawGTree" and the modif of the xlim/ylim may well be messed up too.

If anybody is interested in fixing that, please do and make a pull request.

The aim would be to make the basic example to work: df <- data.frame(gp = factor(rep(letters[1:3], each = 10)), y = rnorm(30))

Compute sample mean and standard deviation in each group

 library(plyr)
 ds <- ddply(df, .(gp), summarise, mean = mean(y), sd = sd(y))
 # Declare the data frame and common aesthetics.
 # The summary data frame ds is used to plot
 # larger red points in a second geom_point() layer.
 # If the data = argument is not specified, it uses the
 # declared data frame from ggplot(); ditto for the aesthetics.
 ggplot(df, aes(x = gp, y = y)) +
    geom_point() +
    geom_point(data = ds, aes(y = mean),
               colour = 'red', size = 3)

zm()