Skip to content
Prev 302404 / 398506 Next

ggplot2 boxplot help

Please use dput() to supply sample data.  

I think this does something like what you want.
####===================================================###
ibrary(ggplot2)
library(reshape2)

 dat1<-read.table(text="
sample_1 sample_2     value_1  value_2
N                  C               1.9268400 36.77590
N                  C               0.1817890  5.58835
N                  C                0.2309000 7.54035
N                 C                  0.0294559 1.50886
N                  C                 0.4678610 14.75560
 N                 C                 10.7258000 92.13150",
       sep="",header=TRUE)


bb  <-  melt(dat1)

p  <-  ggplot(bb  , aes(variable, value, fill =as.factor(value )  )) + 
                      geom_bar(stat= "identity", position = "dodge")  +
                       scale_fill_discrete(name = "Fancy Title") +
                      scale_x_discrete(breaks=c("value_1", "value_2"), labels=c("Sample 1", "Sample 2"))
p
##========================================================##

John Kane
Kingston ON Canada
____________________________________________________________
FREE ONLINE PHOTOSHARING - Share your photos online with your friends and family!
Visit http://www.inbox.com/photosharing to find out more!