Lexis maps in R

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Lexis maps in R

Camarda, Carlo Giovanni
Dear R-users,
Sorry for bothering you twice in a day, but I was wondering whether
there is any R-function which can easily plot the single elements of a
Lexis diagram. I though that Lexis.diagram(Epi) could be the case, but
it just plot life times in a frame.
In particular I have been searching for something similar to the
function "image" which can plot either the single triangles of a Lexis
diagram or the parallelograms (e.g. probability of dying if the event is
the death).
I wrote down a simple example in which I played around with the function
polygon, but in this case the procedure would be too long (normally data
are set in matrix) and also the colors are messed up.
Thanks,
Carlo Giovanni Camarda

## a wrong example for giving an idea of what I'd like to plot
x <- 0:4
A <- matrix(1:16,ncol=4)
image(x,x,A, col="white")
colo <- rainbow(12)
for(i in 1:4){
    x1 <- c(0,1,2,1)
    y1 <- c(0,0,1,1) + i -1
    x2 <- x1+1
    y2 <- y1
    x3 <- x2+1
    y3 <- y2
    polygon(x1,y1,col=colo[i + i - 1])
    polygon(x2,y2,col=colo[i+i])
    polygon(x3,y3,col=colo[i+i+1])
}




+++++
This mail has been sent through the MPI for Demographic Rese...{{dropped}}

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html