# 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))

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