Re: [R] how to rotate a triangle image(ZMAT) ?

From: François Pinard <pinard_at_iro.umontreal.ca>
Date: Wed 28 Jun 2006 - 05:45:33 EST

[Cleber N.Borges]

> how to align this Zmat (triangle image) in X axis? I would like that
> the triangle's base become in the X axis and the triangle's height
> become in the Y axis. Is there some trick for make this?

I'm not fully sure of what is the base and the height of the triangle, but if I guess correctly, you may peek at "?image", the last paragraph of the "Details:" section, and also in the "Examples:" section, where it says "Need to transpose and flip matrix horizontally.". Maybe you'll find some explanations or ideas in there.

> f <- function(x, y) {
> z = 1-x-y
> z[z < (-1e-15)] <- NA

    return(-100*x+0*y+100*z)
> }

> x = seq(1, 0, by = -0.01)
> y = seq(1, 0, by = -0.01)
> zmat = outer(x, y, f)

> image(zmat, col=terrain.colors(10))
> contour(zmat, add=T)

Another idea is to exchange "x, y" in the "outer" call, and maybe also use "rev()" on one of them.

-- 
François Pinard   http://pinard.progiciels-bpi.ca

______________________________________________
R-help@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
Received on Wed Jun 28 09:01:04 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 28 Jun 2006 - 10:13:39 EST.

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