Skip to content

RFC: package pixmap

5 messages · Agustin Lobo, Friedrich Leisch

#
> Hi! I'm testing pixmap. I've found the following:

  >> dim(lissN543)
  > [1] 270 900   3
  >> a <- pixmap(lissN543/255,ncol=900,nrow=270,type="rgb")
  >> dim(a)
  > [1] 270 900   3
  >> 
  >> plot.pixmap(a)

  > ...and I get the image as a vertical rectangle (I was expecting an
  > horizontal rectangle). Is this an error or am I doing something 
  > wrong?

You have 900 columns and only 270 rows, hence you should have a
vertical rectangle that is approx. 3 times as wide as high.

The difference to calling image() on a matrix is deliberate: if you
store a picture as a matrix (as usual), then you'd expect element 1,1
of that matrix to correspond to the upper left corner. That is
different from what image() does, because it was designed for doing
the right thing for matrices produced by, e.g., outer() ... [at least
I think that's the reason for image() rotating the matrix].

Best,
Fritz
#
Hi! I'm testing pixmap. I've found the following:
[1] 270 900   3
[1] 270 900   3
...and I get the image as a vertical rectangle (I was expecting an
horizontal rectangle). Is this an error or am I doing something 
wrong?

Agus


Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo@ija.csic.es
On Thu, 6 Sep 2001, Friedrich Leisch wrote:

            
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Thu, 4 Oct 2001, Friedrich Leisch wrote:

            
I agree with the point that the upper left corner must be the
1,1 cell in the matrix for a "natural" display of the matrix
as an image. But this does not mean that the matrix should be rotated.
In all image processing packages that I know of, an image with
200 cols and 100 rows is displayed as a horizontal rectangle. Note
that, if there is geometric correction to a geographic projection,
the columns go W to E as left to right and the rows N to S as
top to bottom. In fact,
the "natural" display should follow the same geometry than print,
i.e.,
[,1] [,2] [,3] [,4] [,5] [,6]
[1,]    1    3    5    7    9   11
[2,]    2    4    6    8   10   12
should be displayed as a horizontal rectangle.

Of course you can do it as you want because this is your package,
but are you sure that you want it the way it is?

Regards,

Agus


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
--RL6cCFzpfl
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit

        
> On Thu, 4 Oct 2001, Friedrich Leisch wrote:
[...]

  > I agree with the point that the upper left corner must be the
  > 1,1 cell in the matrix for a "natural" display of the matrix
  > as an image. But this does not mean that the matrix should be rotated.
  > In all image processing packages that I know of, an image with
  > 200 cols and 100 rows is displayed as a horizontal rectangle. Note
  > that, if there is geometric correction to a geographic projection,
  > the columns go W to E as left to right and the rows N to S as
  > top to bottom. In fact,
  > the "natural" display should follow the same geometry than print,
  > i.e.,

  >> matrix(1:12,ncol=6,nrow=2)
  >      [,1] [,2] [,3] [,4] [,5] [,6]
  > [1,]    1    3    5    7    9   11
  > [2,]    2    4    6    8   10   12
  >> 

  > should be displayed as a horizontal rectangle.

Excactly, I agree with everything you say!

you mean it doesn't do that? which version of pixmap, which version of
R on which platform?

Using 

R> x <- matrix(1:12,ncol=6,nrow=2)
R> library(pixmap)
R> plot(as.pixmap(x))

I get the attached picture, which is what you want, no?

Best,
Fritz


--RL6cCFzpfl
Content-Type: image/png
Content-Disposition: inline;
	filename="pixmap.png"
Content-Transfer-Encoding: base64

iVBORw0KGgoAAAANSUhEUgAAAg4AAAInCAIAAAB/ekaQAAA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j22LuvpY2wVXksYW88xhPehbST9vgMb
nqXPd2Mwr6g+2efyg/iXrfSeNL6kv811ZC9qx3zr1f/Y5Pvw0WTPb4dhvqKhb67D+dbb3L+svQoA
AqkAIJAKAABga/4fgKfzq8MxJI8AAAAHdElNRQfRCgQODA/m8JVLAAAAAElFTkSuQmCC
--RL6cCFzpfl--
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
ok, found the pronlem: my fault.
I was using v.0.1. With Version: 0.2-1
it's ok. 

I observe that you stretch lineraly now within
pixmap. The problem is that you use the max
of all 3 bands, which is not normally good.
Also an optional "normal" stretching should
provide better results in most cases. I'll 
send you the code and an attached example
(only to Friedrich.Leisch@ci.tuwien.ac.at to avoid
annoying other people) in a while.

Agus


Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo@ija.csic.es


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._