On 31/08/2011 10:33 AM, Dan Carpenter wrote:> Hello,
>
> I am trying to plot SADIE red-blue plots of cluster indicies using
> filled.contour. I want a plot which only has three bins for the data:
> <-1.5, -1.5 - 1.5,>1.5, but I am having trouble getting there.
>
> example
> X1 X2 X3 X4 X5
> 1 -5 -4.5 1.0 4.5 6
> 2 -3 -2.0 1.2 -1.0 3
> 3 0 0.0 0.0 -0.5 -1
> 4 -2 -3.0 1.0 1.5 3
> 5 -6 -2.0 0.5 3.0 2
> example<-as.matrix(example)
> filled.contour(example)
> filled.contour(example,levels=seq(min(example),max(example)),
>
color.palette=colorRampPalette(c("blue","white","red")))
>
> I tried this to get just three bins, but data outside that range
doesn't
> plot.
> seq(-4.5,4.5,by=3)
> [1] -4.5 -1.5 1.5 4.5
> filled.contour(example, levels=seq(-4.5,4.5,by=3),
>
color.palette=colorRampPalette(c("blue","white","red")))
>
> I increased the range but I now have two shades of red and blue, when
> what I really want is one shade of each
> seq(-7.5,7.5,by=3)
> [1] -7.5 -4.5 -1.5 1.5 4.5 7.5
> filled.contour(example, levels=seq(-7.5,7.5,by=3),
>
color.palette=colorRampPalette(c("blue","white","red")))
>
> Is there a way to either
> 1) Create unequal bins, so all data below -1.5 is blue and all data
> above 1.5 red
> Or
> 2) colour more than one bin the same shade
1) Just say where you want the breaks, e.g. levels=c(min(example), -1.5,
1.5, max(example))
2) Give the colours you want using something like col=c("red",
"white",
"red")
Duncan Murdoch