[R] Histogram/Bar plot graph
Senthil Kumar M
senthil.debian at gmail.com
Wed Feb 6 11:45:48 CET 2008
On Feb 6, 2008 2:35 AM, ONKELINX, Thierry <Thierry.ONKELINX at inbo.be> wrote:
> You'll need to transform your dataset in a long format first.
>
> library(ggplot2)
> n <- 5
> MyValues <- data.frame(Gene = factor(LETTERS[seq_len(n)]), ES =
> rnorm(n), MEF = rnorm(n), Embrio = rnorm(n), EShyp = rnorm(n))
> MyValuesMelt <- melt(MyValues, id.var = "Gene")
> ggplot(MyValuesMelt, aes(x = Gene, y = value, fill = variable)) +
> geom_bar(position = "dodge")
> ggplot(MyValuesMelt, aes(x = Gene, y = value)) + geom_bar(position =
> "dodge") + facet_grid(. ~ variable)
>
Hi Thierry,
Splendid! It is exactly what I wanted.
Now, I am actually studying your reply to understand what those
commands *actually* do.
Thanks a lot,
Sincerely Yours,
Senthil
More information about the R-help
mailing list