Quantcast

heatmap with values

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

heatmap with values

Agustin Lobo
Hi!
I'm displaying a contingency table with heatmap():
> svm.predPix.tabla

svm.predPix CC DD LL NN NN2
        CC  22  0  3  8   3
        DD   0 27  0  1   0
        LL   1  1 90  3   7
        NN   2  0  1 11   4
        NN2  0  0  5  1  20


> heatmap(svm.predPix.tabla[5:1,], Rowv=NA, Colv=NA,col =
rev(heat.colors(32)), scale="column",  margins=c(5,10))

and I'm happy with the plot except that I would like to have the actual
values displayed within each cell.  Any help on how
to achieve this?

Data in
https://sites.google.com/site/openfiles2/home/svm.predPix.tabla.rda

Thanks,

Agus

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: heatmap with values

Jim Lemon
On 06/14/2011 08:53 PM, Agustin Lobo wrote:

> Hi!
> I'm displaying a contingency table with heatmap():
>> svm.predPix.tabla
>
> svm.predPix CC DD LL NN NN2
>          CC  22  0  3  8   3
>          DD   0 27  0  1   0
>          LL   1  1 90  3   7
>          NN   2  0  1 11   4
>          NN2  0  0  5  1  20
>
>
>> heatmap(svm.predPix.tabla[5:1,], Rowv=NA, Colv=NA,col =
> rev(heat.colors(32)), scale="column",  margins=c(5,10))
>
> and I'm happy with the plot except that I would like to have the actual
> values displayed within each cell.  Any help on how
> to achieve this?
>
> Data in
> https://sites.google.com/site/openfiles2/home/svm.predPix.tabla.rda
>
Hi Agustin,
I was going to send the code from color2D.matplot to display the values,
but it required so much modification that I would suggest:

library(plotrix)
color2D.matplot(svm.predPix.tabla,show.values=TRUE,axes=FALSE,
  xlab="",ylab="")
axis(1,at=0.5:4.5,labels=rownames(svm.predPix.tabla))
axis(2,at=4.5:0.5,labels=colnames(svm.predPix.tabla))

Jim

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Loading...