plot3dPdf: ~ Function: plot3dPdf for ClusterLongData3d ~

plot3dPdfR Documentation

~ Function: plot3dPdf for ClusterLongData3d ~

Description

Given a ClusterLongData3d and a Partition, this function create Triangle objects representing the 3D plot of two variables of the main trajectories.

Usage

## S4 method for signature 'ClusterLongData3d,missing'
plot3dPdf(x,y,varY=1,varZ=2)
## S4 method for signature 'ClusterLongData3d,numeric'
plot3dPdf(x,y,varY=1,varZ=2)

Arguments

x

[ClusterLongData]: Object containing the trajectories to plot.

y

[numeric]: Define Partition P that will be use to plot the object. P is a Partition hold in the field c2, c3, ... c26. If y=c(a,b), then P is the Partition number b with a clusters. If y=a, then P is the partition number 1 with a clusters. If y is missing, P is the Partition with the best criterion.

varY

[numeric] or [character]: either the number or the name of the first variable to display. 1 by default.

varZ

[numeric] or [character]: either the number or the name of the second variable to display. 2 by default.

Details

Create Triangle objects representing the 3D plot of the main trajectories of a ClusterLongData.

The three functions plot3dPdf, saveTrianglesAsASY and makeLatexFile are design to export a 3D graph to a Pdf file. The process is the following:

  1. plot3dPdf: Create a scene, that is a collection of Triangle object that represent a 3D images.

  2. saveTrianglesAsASY: Export the scene in an '.asy' file.

  3. '.azy' can not be include in LaTeX file. LaTeX can read only '.pre' file. So the next step is to use asymptote to convert '.asy' tp '.pre'. This is done by the command asy -inlineimage -tex pdflatex scene.azy.

  4. The previous step did produce a file scene+0.prc that can be include in a LaTeX file. makeLatexFile create a LaTeX file that is directly compilable (using pdfLatex). It produce a pdf file that contain the 3D object.

Value

A Triangle object.

Author(s)

Christophe Genolini
INSERM U669 / PSIGIAM: Paris Sud Innovation Group in Adolescent Mental Health
Modal'X / Universite Paris Ouest-Nanterre- La Defense

Contact author : genolini@u-paris10.fr

References

Article "KmL: K-means for Longitudinal Data", in Computational Statistics, Volume 25, Issue 2 (2010), Page 317.
Web site: http://christophe.genolini.free.fr/kml/

See Also

makeTriangles

Examples

  ### Move to tempdir
  wd <- getwd()
  setwd(tempdir()); getwd()
  
  ### Generating the data
  myCld3d <- gald3d(c(5,5,5))
  kml3d(myCld3d,3:4,1)

  ### Creation of the scene
  scene <- plot3dPdf(myCld3d,3)
  drawScene.rgl(scene)

  ### Export in '.azy' file
  saveTrianglesAsASY(scene)

  ### Creation of a '.prc' file
  # Open a console window, then run
  # asy -inlineimage -tex pdflatex scene.azy

  ### Creation of the LaTeX main document
  makeLatexFile()

  ### Creation of the '.pdf'
  # Open a console window, then run
  # pdfLatex main.tex
  
  ### Go back to current dir
  setwd(wd)

kml3d documentation built on Feb. 16, 2023, 9:44 p.m.