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:
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
: 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
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
4 matches
Mail list logo