[R] ggplot2 reorder factors for faceting

2011-11-08 Thread Iain Gallagher
Dear List I am trying to draw a heatmap using ggplot2. In this heatmap I have faceted my data by 'infection' of which I have four. These four infections break down into two types and I would like to reorder the 'infection' column of my data to reflect this. Toy example below:

Re: [R] ggplot2 reorder factors for faceting

2011-11-08 Thread Kenneth Frost
Hi, Iain- You might want to have a look at ?relevel i.e.  plotData$infection-relevel(plotData$infection, ref = 'InfC') Ken On 11/08/11, Iain Gallagher wrote: Dear List I am trying to draw a heatmap using ggplot2. In this heatmap I have faceted my data by 'infection' of

Re: [R] ggplot2 reorder factors for faceting

2011-11-08 Thread ONKELINX, Thierry
: r-help Onderwerp: [R] ggplot2 reorder factors for faceting Dear List I am trying to draw a heatmap using ggplot2. In this heatmap I have faceted my data by 'infection' of which I have four. These four infections break down into two types and I would like to reorder the 'infection

Re: [R] ggplot2 reorder factors for faceting

2011-11-08 Thread Dennis Murphy
Hi: (1) Here is one way to reorganize the levels of a factor: plotData[['infection']] - factor(plotData[['infection']], levels = c('InfA', 'InfC', 'InfB', 'InfD')) Do this ahead of the call to ggplot(), preferably after plotData is defined. relevel() resets the