1

I get some result from simulation, and i want to make a facetting like this diagram below, and i don't know if it's possible to make this with ggplot2 and the facet_grid option.

My result for simulations have this "simplified" form, one line by simulation :

dat <- read.table(textConnection("P1 P2 P3 P4 R 
1 2e-5 1.0 0.6 3 1
2 4e-6 1.5 0.7 1.5 2
3 6e-7 1.2 0.6 2.5 3 
4 8e-8 1.45  0.65 3.2 4
"))

And here you can see the simplified graphic i want to produce with ggplot2 and facet_grid

graphic image ggplot2

I have one facet/graph by parameter, with different scale corresponding to min/max values for each of my parameter... You can also see on this graphic the color correspondance to localize each simulation in parameter space.

Thanks a lot for help

SR.

2
  • Aside from the small typo ("06" rather than "0.6") I don't think your data matches your intended graph. Is there an extra column or a missing column header? As it is, it looks like the data that goes with P1 is actually in the ID column. Commented Jun 1, 2012 at 14:36
  • Thanks, i correct the mistake. Graphics and data are for example, so data don't really represent the simplified figure :) Commented Jun 1, 2012 at 14:41

1 Answer 1

5

Here is a start:

library(plyr)
library(ggplot2)
dat.melt <- melt(data, id.vars='R')

ggplot(dat.melt, aes(x=0, y=value)) +
    geom_boxplot() +
    geom_point(aes(colour=factor(R))) +
    facet_wrap(~variable, ncol=1, scales='free') +
    coord_flip()

Plenty of other tweaks, but the gist is there. Usually a good first step is to melt the data long and then start fiddling. As a side note, its a good idea to avoid using data for a variable name since its a built in function.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, i have some problem to fix xscale with ggplot2 and facet option, so i post a new question on stackoverflow stackoverflow.com/questions/10869540/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.