disstree2dot: Graphical representation of a dissimilarity tree

View source: R/disstree2dot.R

disstree2dotR Documentation

Graphical representation of a dissimilarity tree

Description

Functions to generate a "dot" file and associated images files that can be used in GraphViz to get a graphical representation of the tree.

Usage

disstree2dot(tree, filename, digits = 3, image.fun = NULL, image.data = NULL,
  only.leaf = FALSE, device = "jpeg", image.format = "jpg",
  device.args = list(), use.title = TRUE, label.pos = "main",
  node.pos = "main", split.pos = "sub", cex.main = 1,
  legend.text = NULL, image.legend = NULL, image.quality = NULL,
  show.depth = FALSE, title.outer = FALSE,
  imagefunc, imagedata, imgLeafOnly, devicefunc, imageext,
  device.arg, label.loc, node.loc, split.loc, title.cex, legendtext,
  legendimage, qualityimage, showdepth, ...)

disstree2dotp(tree, filename, image.data = NULL, only.leaf = FALSE,
  image.fun = plot, cex.main = 3, with.quality = TRUE,
  cex.quality = cex.main, title.outer = FALSE,
  imagedata, imgLeafOnly, imagefunc, title.cex, withquality,
  quality.fontsize, ...)

seqtree2dot(tree, filename, seqdata = tree$info$object, only.leaf = FALSE,
  sortv = NULL, diss = NULL, cex.main = 3, with.legend = "auto",
  cex.legend = cex.main, with.quality = FALSE,
  cex.quality = cex.main, xaxis = FALSE,
  imgLeafOnly, dist.matrix, title.cex,
  withlegend, withquality, axes,  ...)

Arguments

tree

The tree to be plotted.

filename

A filename, without extension, that will be used to generate image and dot files.

digits

Number of significant digits to plot.

image.fun

A function to plot the individuals in a node, see details.

image.data

a data.frame that will be passed to image.fun, see details.

only.leaf

Logical: If TRUE, only terminal node will be plotted.

device

A device function, "jpeg" by default.

image.format

extension for image files.

device.args

Argument passed to device.

use.title

Logical: If TRUE, node information will be printed using title command, see details.

label.pos

Location of the node label, see title for possible values.

node.pos

Node content location, see title for possible values.

split.pos

Split information location, see title for possible values.

cex.main

cex applied to all calls to title (see use.title).

title.outer

Logical: If TRUE, the title (see use.title) is printed in the outer margins.

legend.text

An optional text appearing in a distinct node.

image.legend

An optional image file appearing in a distinct node.

image.quality

An optional image file appearing in a distinct node.

show.depth

Logical. If TRUE, information about depth of the tree is added to the plot.

with.quality

If TRUE, a node displaying fitting measures of the tree is added to the plot.

cex.quality

Numeric. Size of the font of the fitting measures node.

seqdata

a sequence object as defined by the the seqdef function.

sortv

The name of an optional variable used to sort the data before plotting, see seqplot.

diss

The name of an optional dissimilarity matrix used to find representative sequences, seqrplot.

with.legend

defines if and where the legend of the state colors is plotted. The default value "auto" sets the position of the legend automatically. Other possible value is "right". Obsolete value TRUE is equivalent to "auto".

cex.legend

Size of the font of the legend.

xaxis

Logical. Should the x-axis be drawn on the plots?

imagefunc

Deprecated. Use image.fun instead.

imagedata

Deprecated. Use image.data instead.

imgLeafOnly

Deprecated. Use only.leaf instead.

devicefunc

Deprecated. Use device instead.

imageext

Deprecated. Use image.format instead.

device.arg

Deprecated. Use device.args instead.

label.loc

Deprecated. Use label.pos instead.

node.loc

Deprecated. Use node.pos instead.

split.loc

Deprecated. Use split.pos instead.

title.cex

Deprecated. Use cex.main instead.

legendtext

Deprecated. Use legend.text instead.

legendimage

Deprecated. Use image.legend instead.

qualityimage

Deprecated. Use image.quality instead.

showdepth

Deprecated. Use show.depth instead.

withquality

Deprecated. Use with.quality instead.

quality.fontsize

Deprecated. Use cex.quality instead.

dist.matrix

Deprecated. Use diss instead.

withlegend

Deprecated. Use with.legend instead.

axes

Deprecated. Use xaxis instead.

...

other parameters that will be passed to image.fun or seqplot (for seqtree2dot).

Details

These functions generate a "dot" file that can be used in GraphViz (http://www.graphviz.org). It also generates one image per node through a call to image.fun passing the selected lines of image.data if present or otherwise a list of indexes (of individuals belonging to a node). These functions are not intended to be used by end-user. See seqtreedisplay and disstreedisplay for a much simpler way to generate a graphical representation of a tree (seqtree or disstree).

If the path to GraphViz is not found, pass the path as gvpath argument among the ... list.

seqtree2dot is a shortcut for sequences objects using the plot function seqplot. For each node, it calls seqplot with the corresponding subset of rows of seqdata and the provided seqplot's arguments. You should at least specify the type of the plot (e.g. type="d", see seqplot for more details).

If use.title is TRUE, image.fun should take care to leave enough space for the title.

disstree2dotp is a simplified interface of disstree2dot which automatically leaves enough space for the title and subtitles. These functions are intended to be generic.

Value

Nothing but generates a "dot" and several image files (one per node) in the current working directory (see getwd and setwd).

Author(s)

Matthias Studer (with Gilbert Ritschard for the help page)

See Also

seqtree and seqtreedisplay, disstree and disstreedisplay.


TraMineR documentation built on May 29, 2024, 5 a.m.