[R] Surprise when mapping matrix to image
Henrik Bengtsson
hb at maths.lth.se
Fri Aug 27 02:47:19 CEST 2004
I've got some simple code example at http://www.maths.lth.se/help/R/image/,
or just try:
source("http://www.maths.lth.se/help/R/image/image.R")
Best wishes
Henrik Bengtsson
> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Jim Brennan
> Sent: Friday, August 27, 2004 1:43 AM
> To: rossini at u.washington.edu; r-help at stat.math.ethz.ch
> Subject: Re: [R] Surprise when mapping matrix to image
>
>
> I was also surprised by the image orientation this summer and
> used the "easy" fix of matrix manipulation. There is however
> another issue and that is when you start flipping around the
> matrix, orders etc. and for the case you want to have
> sensibly labeled axes, you may have to use the axis commands
> etc. which is also easy, but accumulation of easy fixes can
> be tedious so there is perhaps some argument for yet another
> new documentation submission. Maybe a method for easily
> changing the orientation in image could be added.
>
> Jim
> ----- Original Message -----
> From: "A.J. Rossini" <rossini at blindglobe.net>
> To: <r-help at stat.math.ethz.ch>
> Sent: Thursday, August 26, 2004 7:11 PM
> Subject: Re: [R] Surprise when mapping matrix to image
>
>
> >
> > 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}}
> >
> > ______________________________________________
> > 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
>
> ______________________________________________
> 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
>
>
More information about the R-help
mailing list