1

New in data representation and using ggplot2

I plotted data using boxplot like this

p <- ggplot(data, aes(x, y, colour=foo, fill=bar)) p + geom_boxplot()

data my data_frame
x is a 3 level factor
y is numeric (obviously)
foo is a 2 level factor
bar is a 3 level factor

So I have 3 * 2 * 3 = 18 boxplots (18 levels) from 3 different factors

On data I have an other column with mostly NA and sometime the duplicated y value, let's call it y_special (Before I had just TRUE marker instead of a duplicated value in this column, but I later assumed it will be easier to plot it that way)

I would like to plot y_special with geom_point on top of the corresponding boxplot

Steven Beaupré
  • 21,343
  • 7
  • 57
  • 77
zakrapovic
  • 413
  • 3
  • 17
  • 2
    Either `+ geom_point(aes(y = y_sepecial))` will work or you'll need to make [a reproducible example](http://stackoverflow.com/q/5963269/903061). – Gregor Thomas Mar 31 '16 at 21:52
  • I already tried this solution, it plots it on top of the factor x, but it does not dispatch on the other. So it plot the y_special at 3 different levels instead of 18. It is late, I will check tomorrow for reproductible exemple. Thanks anyway. – zakrapovic Mar 31 '16 at 21:54
  • 3
    Well, like my comment said **or you'll need to make a reproducible example**. Please click the link in my first comment for tips on making a reproducible example. You can edit your question to include simulated data, built-in data, or if those don't work for you, real data shared with `dput()`. – Gregor Thomas Mar 31 '16 at 21:57
  • Thanks :)! I will do – zakrapovic Mar 31 '16 at 22:02
  • 1
    As part of that reproducible example, you will want to provide data. You can use `dput` as in `dput(data)`. – steveb Mar 31 '16 at 22:18

0 Answers0