[R] Surprise when mapping matrix to image

A.J. Rossini rossini at blindglobe.net
Fri Aug 27 01:11:04 CEST 2004


I think I'd have to respectfully disagree with both Brian and
Deepayan, as to whether it should be obvious.  It is reasonable
(principle of least suprise) to expect orientation of the plot to
match the print order of the matrix.  I would have expected Brian's
one-liner to be in the help page, with a notice.  It's a not-so-rare
activity, being a general matrix visualization that is commonly used
in certain areas of science (whether it ought to be commonly used is a
separate question).

While "heatmap" might've been perhaps a better pointer, but it doesn't
seem to do the "right" thing, either.  I.e. 

myTemp <- matrix(c(1,2,3,3,2,3),nrow=2)
heatmap(myTemp,Rowv=NA,Colv=NA)

doesn't look right to me (R Version 1.9.1  (2004-06-21))

I see the "pixmap/bitmap" issue as a bit of a red herring, in this
case. 

best,
-tony

p.s. I seem to get bit by this about once a year for the last few,
hence why I'm speaking up.








Deepayan Sarkar <deepayan at cs.wisc.edu> writes:

> Quoting "Glynn, Earl" <EFG at Stowers-Institute.org>:
>
>> Prof Ripley:
>> 
>> Thank you for your prompt reply.
>> 
>> > It's pure convention: see below.
>> > 
>> > Did you try reading the help for image?  You don't seem to 
>> > understand it
>> > if you actually did.  It seems you are looking for
>> > 
>> >  image(t(x)[ncol(x):1, ])
>> 
>> I think you guys are too close to "R" to understand how hard it is to
>> use sometimes.  What may be blatantly obvious to you is quite a problem
>> especially to beginners.  Some of us may be beginners to R, but we know
>> math, science, programming, and how to solve problems with other tools
>> and languages.    
>> 
>> I re-read the guidelines before posting fearing condemnation.
>> 
>> Before posting I searched the online R-help Google interface with
>> keywords "image", "flip", "rotate".  A discussion from 1998 touched on
>> this issue but I was hoping that this was deemed a "bug" at some point
>> and fixed -- or had an easy workaround, like some parameter I was
>> missing.
>> 
>> I read the "?image" help before posting. Was the part I didn't
>> understand buried in this "note"?
>> 
>>      "Based on a function by Thomas Lumley tlumley at u.washington.edu."
>
> You seem to be thinking that Prof Ripley's solution had something to do with
> image(). It doesn't, it has to do with manipulating a matrix. image()
> visualizes a matrix in a particular and well-defined way. You want your matrix
> to be shown in a different way, and one (simple) way of doing that is to
> convert your matrix into a different matrix, on which calling image would give
> you what you want. Why would this be explained in ?image ? This is basic R.
>
> More generally, I think your frustration is caused by your expectation that a
> matrix object should behave like a bitmap image. It doesn't. If you want work
> with images, use the pixmap package.
>
> Deepayan
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Anthony Rossini			    Research Associate Professor
rossini at u.washington.edu            http://www.analytics.washington.edu/ 
Biomedical and Health Informatics   University of Washington
Biostatistics, SCHARP/HVTN          Fred Hutchinson Cancer Research Center
UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable
FHCRC  (M/W): 206-667-7025 FAX=206-667-4812 | use Email

CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}}




More information about the R-help mailing list