Learn R Programming

spatsurv (version 2.0)

surv3d: Spatial Survival Plot in 3D

Description

Do a 3d plot of spatial survival data

Usage

surv3d(
  spp,
  ss,
  lwd = 2,
  lcol = "black",
  lalpha = 1,
  pstyle = c("point", "text"),
  psize = c(20, 10),
  pcol = c("red", "black"),
  ptext = c("X", ""),
  palpha = 1,
  title = "Spatial Survival",
  basegrid = TRUE,
  baseplane = TRUE
)

Value

nothing

Arguments

spp

A spatial points data frame

ss

A Surv object (with right-censoring)

lwd

Line width for stems

lcol

Line colour for stems

lalpha

Opacity for stems

pstyle

Point style "point" or "text"

psize

Vector of length 2 for uncensored/censored points size

pcol

Vector of length 2 for uncensored/censored points colours

ptext

Vector of length 2 for uncensored/censored text characters

palpha

Opacity for points/text

title

Main title for plot

basegrid

add a grid at t=0

baseplane

add a plane at t=0

Author

Barry S Rowlingson

Details

Uses rgl graphics to make a spinny zoomy plot

Examples

Run this code
if (FALSE) {
require(sp)
require(survival)
d = data.frame(
  x=runif(40)*1.5,
  y = runif(40),
  age=as.integer(20+30*runif(40)),
  sex = sample(c("M","F"),40,TRUE)
)
coordinates(d)=~x+y
d$surv = Surv(as.integer(5+20*runif(40)),runif(40)>.9)
clear3d();surv3d(d,d$surv,baseplane=TRUE,basegrid=TRUE)
clear3d();surv3d(d,d$surv,baseplane=TRUE,basegrid=TRUE,pstyle="t",lalpha=0.5,lwd=3,palpha=1)
}

Run the code above in your browser using DataLab