From: Lorenzo Isella <lorenzo.isella_at_gmail.com>

Date: Wed, 23 Jun 2010 19:01:13 +0200

## axis(1,at=c(0.5,1.5,2.5,3.5,4.5),labels=prefix_vec_short)

## axis(2,at=rev(c(0.5,1.5,2.5,3.5,4.5)),labels=prefix_vec_short)

box()

par(oldpar)

dev.off()

## axis(1,at=c(0.5,1.5,2.5,3.5,4.5),labels=prefix_vec_short)

## axis(2,at=rev(c(0.5,1.5,2.5,3.5,4.5)),labels=prefix_vec_short)

box()

par(oldpar)

dev.off()

R-help_at_r-project.org 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. Received on Wed 23 Jun 2010 - 17:04:12 GMT

Date: Wed, 23 Jun 2010 19:01:13 +0200

Dear All,

I am using the plotrix library to plot some matrices.
I have a problem: some of my data are outliers, hence using a linear
color scale does not work very well (you would see too many cells having
a similar, indistinguishable color). See the code snipped at the end of
the email.

Plotting the logarithm of the data gets the job done, but my problem is
that I would like to write in every cell the value of the corresponding
entry of the original matrix, not is logarithm.
Does anyone know how to get this done? Or the other way around: leave
the data as is, but use a color log scale.
Many thanks

Lorenzo

library(plotrix)

set.seed(1234)

myseq <- abs(rnorm(25))

myseq[20] <- 100 #introduce outlier!

A <- matrix(myseq, ncol=5,nrow=5)

#nasty looking figure

pdf("test_color_scale.pdf")

oldpar<-par( mar = c(4.5,5, 2, 1) + 0.1,
cex.axis=1.4,cex.lab=1.6,cex.main=1.6)

color2D.matplot(A,main="Title",c(0.2,1),c(0.2,0.5),c(0,0),
xlab = "",

ylab="",

show.legend=TRUE,

show.values=1,vcol="black",vcex=1, axes=FALSE)

## axis(1,at=c(0.5,1.5,2.5,3.5,4.5),labels=prefix_vec_short)

## axis(2,at=rev(c(0.5,1.5,2.5,3.5,4.5)),labels=prefix_vec_short)

box()

par(oldpar)

dev.off()

#this looks better, but in each cell I would like to see the same

#numbers as before.

pdf("test_color_scale_log.pdf")

oldpar<-par( mar = c(4.5,5, 2, 1) + 0.1,
cex.axis=1.4,cex.lab=1.6,cex.main=1.6)

color2D.matplot(log(A),main="Title",c(0.2,1),c(0.2,0.5),c(0,0),
xlab = "",

ylab="",

show.legend=TRUE,

show.values=1,vcol="black",vcex=1, axes=FALSE)

## axis(1,at=c(0.5,1.5,2.5,3.5,4.5),labels=prefix_vec_short)

## axis(2,at=rev(c(0.5,1.5,2.5,3.5,4.5)),labels=prefix_vec_short)

box()

par(oldpar)

dev.off()

R-help_at_r-project.org 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. Received on Wed 23 Jun 2010 - 17:04:12 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Thu 24 Jun 2010 - 07:40:34 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*