Multiple layered plots

9 views
Skip to first unread message

teragene

unread,
Mar 2, 2009, 8:38:32 PM3/2/09
to ggplot2
I have 2 different dataset. Each dataset have different numbers of
rows.

(SET1)
E-val, Bit_score
1,3
2,1
3,3
1,4
3,3
4,9

(SET2)
E-val, Bit_score
4,6
9,2
9,1
0,3
1,4
9,4
4,5
3,2

SET1 has 6 rows and SET2 contains 8 rows.
With these two sets, I want to plot boxplot with facets.

Y-axis(left): values
X-axis: SET names
Y-axis(right): categories(E-value, Bit_score)

| _ _ |
| |_| |_| | Bit_score
| |
|__________________________|_____
| _ _ |
| |_| |_| |
| | E-value
|__________________________|____
SET1 SET2

Would you advise me how to deal with this?

THANKS!!!

hadley wickham

unread,
Mar 4, 2009, 10:20:44 AM3/4/09
to teragene, ggplot2
Hi Teragene,

The easiest way is to combine the two datasets together:

set1$set <- 1
set2$set <- 2
all <- rbind(set1, set2)

allm <- melt(all, id = "set")

ggplot(..., data = all) + facet_grid(set ~ variable)

Regards,

Hadley
--
http://had.co.nz/
Reply all
Reply to author
Forward
0 new messages