-1

I use this tutorial tu plot a heatmap using ggplot2

http://learnr.wordpress.com/2010/01/26/ggplot2-quick-heatmap-plotting/

now I'd like to order the vertical factor using onother factor with the same length.

strains x1 x2 x3 origin
name     4 2  4   see

Does someone have any idea how does it work?

Thanks

alexmulo
  • 751
  • 4
  • 11
  • 23

1 Answers1

0

If you have an extra column in nba, for instance nba$country, then you can adjust the ordering in the original by

nba$Name <- with(nba, reorder(Name, country))

If you have an alternative annotation that you want to order by, then you'll need to match that in. For instance if you have a player-country data.frame (PC), then

nba$Name <- reorder(nba$Name, PC$country[match(nba$Name, PC$Name)])
Gavin Kelly
  • 2,374
  • 1
  • 10
  • 13