Last data update: 2014.03.03

R: 3D shapes plot
shapes3dShapesR Documentation

3D shapes plot

Description

This function is a slight modification of the original shapes3d function of the shapes R package so that the resulting plot has customized title and axes. Specifically, the changing lines regarding the original function are those related to its argument axes3 when it is fixed to TRUE.

Usage

shapes3dShapes(x,loop=0,type="p",color=2,joinline=c(1:1),
               axes3=FALSE,rglopen=TRUE,main=main)

Arguments

x

See shapes3d.

loop

See shapes3d.

type

See shapes3d.

color

See shapes3d.

joinline

See shapes3d.

axes3

See shapes3d.

rglopen

See shapes3d.

main

Allows us to give the plot a title if axes3=TRUE.

Value

A device with the desired plot.

References

Dryden, I. L., (2012). shapes package. R Foundation for Statistical Computing, Vienna, Austria. Contributed package.

Dryden, I. L., and Mardia, K. V., (1998). Statistical Shape Analysis, Wiley, Chichester.

See Also

shapes3d

Examples

landmarksNoNa <- na.exclude(landmarksSampleSpaSurv)
dim(landmarksNoNa) 
#[1] 574 198 
numLandmarks <- (dim(landmarksNoNa)[2]) / 3
#[1] 66
#As a toy example, only the first 10 individuals are used.
landmarksNoNa_First10 <- landmarksNoNa[1:10, ] 
(numIndiv <- dim(landmarksNoNa_First10)[1])
#[1] 10         
    
array3D <- array3Dlandm(numLandmarks, numIndiv, landmarksNoNa_First10)
#shapes::plotshapes(array3D[,,1]) 
#calibrate::textxy(array3D[,1,1], array3D[,2,1], labs = 1:numLandmarks, cex = 0.7) 

numClust <- 2 ; algSteps <- 1 ; niter <- 1 ; stopCr <- 0.0001
resLL <- LloydShapes(array3D, numClust, algSteps, niter, stopCr, FALSE, FALSE)

prototypes <- anthrCases(resLL)

shapes3dShapes(prototypes[,,1], loop = 0, type = "p", color = 2, joinline = c(1:1), 
            axes3 = TRUE, rglopen = TRUE, main = "Mean shape cluster 1")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Anthropometry)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Anthropometry/shapes3dShapes.Rd_%03d_medium.png", width=480, height=480)
> ### Name: shapes3dShapes
> ### Title: 3D shapes plot
> ### Aliases: shapes3dShapes
> ### Keywords: multivariate
> 
> ### ** Examples
> 
> landmarksNoNa <- na.exclude(landmarksSampleSpaSurv)
> dim(landmarksNoNa) 
[1] 574 198
> #[1] 574 198 
> numLandmarks <- (dim(landmarksNoNa)[2]) / 3
> #[1] 66
> #As a toy example, only the first 10 individuals are used.
> landmarksNoNa_First10 <- landmarksNoNa[1:10, ] 
> (numIndiv <- dim(landmarksNoNa_First10)[1])
[1] 10
> #[1] 10         
>     
> array3D <- array3Dlandm(numLandmarks, numIndiv, landmarksNoNa_First10)
> #shapes::plotshapes(array3D[,,1]) 
> #calibrate::textxy(array3D[,1,1], array3D[,2,1], labs = 1:numLandmarks, cex = 0.7) 
> 
> numClust <- 2 ; algSteps <- 1 ; niter <- 1 ; stopCr <- 0.0001
> resLL <- LloydShapes(array3D, numClust, algSteps, niter, stopCr, FALSE, FALSE)
> 
> prototypes <- anthrCases(resLL)
> 
> shapes3dShapes(prototypes[,,1], loop = 0, type = "p", color = 2, joinline = c(1:1), 
+             axes3 = TRUE, rglopen = TRUE, main = "Mean shape cluster 1")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>