R: Create a tree graph

treegraph {treemap} | R Documentation

## Create a tree graph

### Description

This function draws a tree graph. By default, a radial layout is used.

### Usage

    treegraph(dtf, index = names(dtf), directed = FALSE, palette.HCL.options,
      show.labels = FALSE, rootlabel = "", vertex.layout = "reingold.tilford",
      vertex.layout.params, truncate.labels = NULL, vertex.size = 3,
      vertex.label.dist = 0.3, vertex.label.cex = 0.8,
      vertex.label.family = "sans", vertex.label.color = "black", mai = c(0,
      0, 0, 0), ...)

### Arguments

`dtf` | a data.frame or data.table. Required.
`index` | the index variables of dtf (see `treemap`)
`directed` | logical that determines whether the graph is directed (`TRUE`) or undirected (`FALSE`)
`palette.HCL.options` | list of advanced options to obtain Tree Colors from the HCL space (when `palette="HCL"`). This list contains: `hue_start`: number between 0 and 360 that determines the starting hue value (default: 30) `hue_end`: number between `hue_start` and `hue_start + 360` that determines the ending hue value (default: 390) `hue_perm`: boolean that determines whether the colors are permuted such that adjacent levels get more distinguishable colors. If `FALSE`, then the colors are equally distributed from `hue_start` to `hue_end` (default: TRUE) `hue_rev`: boolean that determines whether the colors of even-numbered branched are reversed (to increase discrimination among branches) `hue_fraction`: number between 0 and 1 that determines the fraction of the hue circle that is used for recursive color picking: if 1 then the full hue circle is used, which means that the hue of the colors of lower-level nodes are spread maximally. If 0, then the hue of the colors of lower-level nodes are identical of the hue of their parents. (default: .5) `chroma`: chroma value of colors of the first-level nodes, that are determined by the first index variable (default: 60) `luminance`: luminance value of colors of the first-level nodes, i.e. determined by the first index variable (default: 70) `chroma_slope`: slope value for chroma of the non-first-level nodes. The chroma values for the second-level nodes are `chroma+chroma_slope`, for the third-level nodes `chroma+2*chroma_slope`, etc. (default: 5) `luminance_slope`: slope value for luminance of the non-first-level nodes (default: -10) For "depth" and "categorical" types, only the first two items are used. Use `treecolors` to experiment with these parameters.
`show.labels` | show the labels
`rootlabel` | name of the rootlabel
`vertex.layout` | layout algorithm name. See `layout` for options. The name corresponds to the layout function name after the period symbol, e.g. "auto", "random", etc. The default is "reingold.tilford" with a cirular layout.
`vertex.layout.params` | list of arguments passed to `vertex.layout`
`truncate.labels` | number of characters at which the levels are truncated. Either a single value for all index variables, or a vector of values for each index variable
`vertex.size` | vertex.size (see `igraph.plotting`)
`vertex.label.dist` | vertex.label.dist (see `igraph.plotting`)
`vertex.label.cex` | vertex.label.cex (see `igraph.plotting`)
`vertex.label.family` | vertex.label.family (see `igraph.plotting`)
`vertex.label.color` | vertex.label.color (see `igraph.plotting`)
`mai` | margins see `par`
`...` | arguments passed to `plot.igraph`

### Value

(invisible) igraph object

### Examples

    data(business)
    treegraph(business, index=c("NACE1", "NACE2", "NACE3", "NACE4"), show.labels=FALSE)
    treegraph(business[business$NACE1=="F - Construction",],
        index=c("NACE2", "NACE3", "NACE4"), show.labels=TRUE, truncate.labels=c(2,4,6))
    treegraph(business[business$NACE1=="F - Construction",],
        index=c("NACE2", "NACE3", "NACE4"), show.labels=TRUE, truncate.labels=c(2,4,6),
        vertex.layout="fruchterman.reingold")

[Package treemap version 2.4-2 Index]