I have a data.frame with gene expression data and I want to create a graph in ggplot2. here's an example for my data frame:
Gene.Name cell.type expression
ABC heart 12
AZF heart 13
ABC kidney 1
AZF kidney 2
and forth. in reality there are 160 genes, 5 tissue types.
I drew a dotplot with the following code:
a <- ggplot(data, aes(x = expression, y = Gene.Name))
a + geom_point() + facet_grid(. ~ cell.type)
Here's a snapshot of the plot
http://i55.tinypic.com/2rgonjp.jpg
what I want to do but can't seem to manage is to order the genes alphabetically. I tried:
a <- ggplot(data, aes(x = expression, reorder(Gene.Name, Gene.Name)))
but this didn't work (the Gene.Name column is alphabetically sorted, so I thought this might change the order but it didn't)
Any suggestions as to how I might change the gene name order?
Thanks