Title: | Treemap Visualization |
---|---|
Description: | A treemap is a space-filling visualization of hierarchical structures. This package offers great flexibility to draw treemaps. |
Authors: | Martijn Tennekes [aut, cre], Peter Ellis [ctb] |
Maintainer: | Martijn Tennekes <[email protected]> |
License: | GPL-3 |
Version: | 2.4-4 |
Built: | 2024-11-17 04:25:09 UTC |
Source: | https://github.com/cran/treemap |
A treemap is a space-filling visualization of hierarchical structures. This package offers great flexibility to draw treemaps.
The main function is treemap
. See also itreemap
for a graphical user interface to create treemaps. By default Tree Colors are used, which are colors from the HCL color space. Use treecolors
to experiment with the parameter settings.
Martijn Tennekes [email protected]
Fictitious (aggregated) business statistics data. The index variables (NACE1
to NACE4
) are derived from the Statistical Classification of Economic Activities in the European Community (NACE). The variables turnover(.prev)
and employees(.prev)
have values for NACE codes in the business economy domain only.
Statistical Classification of Economic Activities in the European Community (NACE) Eurostat - Structural business statistics (SBS)
Gross national income (per capita) in dollars and population totals per country in 2014.
The GNI numbers from the World Bank are based on the Atlas. The population data are taken from Natural Earth Data.
The World Bank - GNI per capita ranking Natural Earth Data
This function is an interactive user interface for creating treemaps. Interaction is provided for the four main input arguments of (treemap
) besides the data.frame itself, namely index
, vSize
, vColor
and type
. Zooming in and out is possible. Command line outputs are generated in the console.
itreemap( dtf = NULL, index = NULL, vSize = NULL, vColor = NULL, type = NULL, height = 700, command.line.output = TRUE )
itreemap( dtf = NULL, index = NULL, vSize = NULL, vColor = NULL, type = NULL, height = 700, command.line.output = TRUE )
dtf |
a data.frame ( |
index |
index variables (up to four). See |
vSize |
name of the variable that determine the rectangle sizes. |
vColor |
name of the variable that determine the rectangle colors. See |
type |
treemap type. See |
height |
height of the plotted treemap in pixels. Tip: decrease this number if the treemap doesn't fit conveniently. |
command.line.output |
if |
This interface will no longer be maintained (except for small bugs), since there is a better interactive interface available: https://github.com/d3treeR/d3treeR.
## Not run: data(business) itreemap(business) ## End(Not run)
## Not run: data(business) itreemap(business) ## End(Not run)
This function generates random hierarchical data. Experimental.
random.hierarchical.data( n = NULL, method = "random", number.children = 3, children.root = 4, depth = 3, nodes.per.layer = NULL, labels = c("LETTERS", "numbers", "letters"), labels.prefix = NULL, sep = ".", colnames = c(paste("index", 1:depth, sep = ""), "x"), value.generator = rlnorm, value.generator.args = NULL )
random.hierarchical.data( n = NULL, method = "random", number.children = 3, children.root = 4, depth = 3, nodes.per.layer = NULL, labels = c("LETTERS", "numbers", "letters"), labels.prefix = NULL, sep = ".", colnames = c(paste("index", 1:depth, sep = ""), "x"), value.generator = rlnorm, value.generator.args = NULL )
n |
number of leaf nodes. This is a shortcut argument. If specified, the method is set to |
method |
one of
|
number.children |
the number of children. For |
children.root |
number of children of the root node. For |
depth |
depth of the tree. Note that for |
nodes.per.layer |
exact number of nodes per layer, that is needed for |
labels |
one of |
labels.prefix |
vector of label prefixes, one for each layer |
sep |
seperator character |
colnames |
names of the columns. The first |
value.generator |
function that determine the random values for the leaf nodes |
value.generator.args |
list of arguments passed to |
d <- random.hierarchical.data(200) treemap(d, index=names(d)[1:(ncol(d)-1)], vSize="x") d <- random.hierarchical.data(number.children=5) treemap(d, index=names(d)[1:(ncol(d)-1)], vSize="x") d <- random.hierarchical.data(method="full.tree", number.children=3, value.generator=runif) treemap(d, index=names(d)[1:(ncol(d)-1)], vSize="x")
d <- random.hierarchical.data(200) treemap(d, index=names(d)[1:(ncol(d)-1)], vSize="x") d <- random.hierarchical.data(number.children=5) treemap(d, index=names(d)[1:(ncol(d)-1)], vSize="x") d <- random.hierarchical.data(method="full.tree", number.children=3, value.generator=runif) treemap(d, index=names(d)[1:(ncol(d)-1)], vSize="x")
This function is migrated to treemap
.
tmPlot(...)
tmPlot(...)
... |
passed on to |
Tree Colors are color palettes for tree data structures. They are used in treemap
by default (type="index"
). With this tool, users can experiment with the parameters (in treemap
stored in palette.HCL.options
). Tree Colors can directly be obtained by treepalette
with method="HCL"
.
treecolors(height = 700)
treecolors(height = 700)
height |
height of the plotted treemap in pixels. Tip: decrease this number if the treemap doesn't fit conveniently. |
## Not run: treecolors() ## End(Not run)
## Not run: treecolors() ## End(Not run)
This function draws a tree graph. By default, a radial layout is used.
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), ... )
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), ... )
dtf |
a data.frame or data.table. Required. |
index |
the index variables of dtf (see |
directed |
logical that determines whether the graph is directed ( |
palette.HCL.options |
list of advanced options to obtain Tree Colors from the HCL space (when
For "depth" and "categorical" types, only the first two items are used. Use |
show.labels |
show the labels |
rootlabel |
name of the rootlabel |
vertex.layout |
layout algorithm name. See |
vertex.layout.params |
list of arguments passed to |
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 |
vertex.label.dist |
vertex.label.dist (see |
vertex.label.cex |
vertex.label.cex (see |
vertex.label.family |
vertex.label.family (see |
vertex.label.color |
vertex.label.color (see |
mai |
margins see |
... |
arguments passed to |
(invisible) igraph object
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")
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")
A treemap is a space-filling visualization of hierarchical structures. This function offers great flexibility to draw treemaps. Required is a data.frame (dtf
) that contains one or more hierarchical index columns given by index
, a column that determines the rectangle area sizes (vSize
), and optionally a column that determines the rectangle colors (vColor
). The way how rectangles are colored is determined by the argument type
.
treemap( dtf, index, vSize, vColor = NULL, stdErr = NULL, type = "index", fun.aggregate = "sum", title = NA, title.legend = NA, algorithm = "pivotSize", sortID = "-size", mirror.x = FALSE, mirror.y = FALSE, palette = NA, palette.HCL.options = NULL, range = NA, mapping = NA, n = 7, na.rm = TRUE, na.color = "#DDDDDD", na.text = "Missing", fontsize.title = 14, fontsize.labels = 11, fontsize.legend = 12, fontcolor.labels = NULL, fontface.labels = c("bold", rep("plain", length(index) - 1)), fontfamily.title = "sans", fontfamily.labels = "sans", fontfamily.legend = "sans", border.col = "black", border.lwds = c(length(index) + 1, (length(index) - 1):1), lowerbound.cex.labels = 0.4, inflate.labels = FALSE, bg.labels = NULL, force.print.labels = FALSE, overlap.labels = 0.5, align.labels = c("center", "center"), xmod.labels = 0, ymod.labels = 0, eval.labels = FALSE, position.legend = NULL, reverse.legend = FALSE, format.legend = NULL, drop.unused.levels = TRUE, aspRatio = NA, vp = NULL, draw = TRUE, ... )
treemap( dtf, index, vSize, vColor = NULL, stdErr = NULL, type = "index", fun.aggregate = "sum", title = NA, title.legend = NA, algorithm = "pivotSize", sortID = "-size", mirror.x = FALSE, mirror.y = FALSE, palette = NA, palette.HCL.options = NULL, range = NA, mapping = NA, n = 7, na.rm = TRUE, na.color = "#DDDDDD", na.text = "Missing", fontsize.title = 14, fontsize.labels = 11, fontsize.legend = 12, fontcolor.labels = NULL, fontface.labels = c("bold", rep("plain", length(index) - 1)), fontfamily.title = "sans", fontfamily.labels = "sans", fontfamily.legend = "sans", border.col = "black", border.lwds = c(length(index) + 1, (length(index) - 1):1), lowerbound.cex.labels = 0.4, inflate.labels = FALSE, bg.labels = NULL, force.print.labels = FALSE, overlap.labels = 0.5, align.labels = c("center", "center"), xmod.labels = 0, ymod.labels = 0, eval.labels = FALSE, position.legend = NULL, reverse.legend = FALSE, format.legend = NULL, drop.unused.levels = TRUE, aspRatio = NA, vp = NULL, draw = TRUE, ... )
dtf |
a data.frame. Required. |
index |
vector of column names in |
vSize |
name of the column in |
vColor |
name of the column that, in combination with |
stdErr |
name of the column that contains standard errors. These are not used for the treemaps, but only aggregated accordingly and returned as item of the output list. |
type |
type of the treemap, which determines how the rectangles are colored:
|
fun.aggregate |
aggregation function, only used in |
title |
title of the treemap. |
title.legend |
title of the legend. |
algorithm |
name of the used algorithm: |
sortID |
name of the variable that determines the order in which the rectangles are placed from top left to bottom right. Only applicable when |
mirror.x |
logical that determines whether the rectangles are mirrored horizontally |
mirror.y |
logical that determines whether the rectangles are mirrored vertically |
palette |
one of the following:
|
palette.HCL.options |
list of advanced options to obtain Tree Colors from the HCL space (when
For "depth" and "categorical" types, only the first two items are used. Use |
range |
range of values (so vector of two) that correspond to the color legend. By default, the range of actual values, determined by |
mapping |
vector of three values that specifies the mapping of the actual values, determined by |
n |
preferred number of categories by which numeric variables are discretized. |
na.rm |
ignore missing vlues for the vSize variable (by default TRUE) |
na.color |
color for missing values for the vColor variable |
na.text |
legend label for missing values for the vColor variable |
fontsize.title |
font size of the title |
fontsize.labels |
font size(s) of the data labels, which is either a single number that specifies the font size for all aggregation levels, or a vector that specifies the font size for each aggregation level. Use value |
fontsize.legend |
font size for the legend |
fontcolor.labels |
Specifies the label colors. Either a single color value, or a vector of color values one for each aggregation level. By default, white and black colors are used, depending on the background ( |
fontface.labels |
either a single value, or a vector of values one for each aggregation level. Values can be integers If an integer, following the R base graphics standard: 1 = plain, 2 = bold, 3 = italic, 4 = bold italic, or characters: |
fontfamily.title |
font family of the title. Standard values are "serif", "sans", "mono", "symbol". Mapping is device dependent. |
fontfamily.labels |
font family of the labels in each rectangle. Standard values are "serif", "sans", "mono", "symbol". Mapping is device dependent. |
fontfamily.legend |
font family of the legend. Standard values are "serif", "sans", "mono", "symbol". Mapping is device dependent. |
border.col |
color of borders drawn around each rectangle. Either one color for all rectangles or a vector of colors, or one for each aggregation level |
border.lwds |
thicknesses of border lines. Either one number specifies the line thicknesses (widths) for all rectangles or a vector of line thicknesses for each aggregation level. |
lowerbound.cex.labels |
multiplier between 0 and 1 that sets the lowerbound for the data label font sizes: 0 means draw all data labels, and 1 means only draw data labels if they fit (given |
inflate.labels |
logical that determines whether data labels are inflated inside the rectangles. If |
bg.labels |
background color of high aggregation labels. Either a color, or a number between 0 and 255 that determines the transparency of the labels. In the latter case, the color itself is determined by the color of the underlying rectangle. For "value" and "categorical" treemaps, the default is (slightly) transparent grey ( |
force.print.labels |
logical that determines whether data labels are being forced to be printed if they don't fit. |
overlap.labels |
number between 0 and 1 that determines the tolerance of the overlap between labels. 0 means that labels of lower levels are not printed if higher level labels overlap, 1 means that labels are always printed. In-between values, for instance the default value .5, means that lower level labels are printed if other labels do not overlap with more than .5 times their area size. |
align.labels |
object that specifies the alignment of the labels. Either a character vector of two values specifying the horizontal alignment ( |
xmod.labels |
the horizontal position modification of the labels in inches. Options: a single value, a vector or a list that specifies the modification for each aggregation level. If a list is provided, each list item consists of a single value or a named vector that specify the modification per label. |
ymod.labels |
the vertical position modification of the labels in inches. Options: a single value, a vector or a list that specifies the modification for each aggregation level. If a list is provided, each list item consists of a single value or a named vector that specify the modification per label. |
eval.labels |
should the text labels, i.e. the factor labels of the |
position.legend |
position of the legend: |
reverse.legend |
should the legend be reversed? |
format.legend |
a list of additional arguments for the formatting of numbers in the legend to pass to |
drop.unused.levels |
logical that determines whether unused levels (if any) are shown in the legend. Applicable for "categorical" treemap type. |
aspRatio |
preferred aspect ratio of the main rectangle, defined by width/height. When set to |
vp |
|
draw |
logical that determines whether to draw the treemap. |
... |
arguments to be passed to other functions. Currently, only |
A list is silently returned:
tm |
a |
type |
argument type |
vSize |
argument vSize |
vColor |
argument vColor |
stdErr |
standard errors |
algorithm |
argument algorithm |
vpCoorX |
x-coordinates of the treemap within the whole plot |
vpCoorY |
y-coordinates of the treemap within the whole plot |
aspRatio |
aspect ratio of the treemap |
range |
range of the color values scale |
Bederson, B., Shneiderman, B., Wattenberg, M. (2002) Ordered and Quantum Treemaps: Making Effective Use of 2D Space to Display Hierarchies. ACM Transactions on Graphics, 21(4): 833-854.
Bruls, D.M., C. Huizing, J.J. van Wijk. Squarified Treemaps. In: W. de Leeuw, R. van Liere (eds.), Data Visualization 2000, Proceedings of the joint Eurographics and IEEE TCVG Symposium on Visualization, 2000, Springer, Vienna, p. 33-42.
######################################### ### quick example with Gross National Income data ######################################### data(GNI2014) treemap(GNI2014, index=c("continent", "iso3"), vSize="population", vColor="GNI", type="value", format.legend = list(scientific = FALSE, big.mark = " ")) ######################################### ### extended examples with fictive business statistics data ######################################### data(business) ######################################### ### treemap types ######################################### # index treemap: colors are determined by the index argument ## Not run: # large example which takes some time... treemap(business, index=c("NACE1", "NACE2", "NACE3"), vSize="turnover", type="index") ## End(Not run) treemap(business[business$NACE1=="C - Manufacturing",], index=c("NACE2", "NACE3"), vSize=c("employees"), type="index") # value treemap: colors are derived from a numeric variable given by vColor # (when omited, all values are set to 1 as in the following example) treemap(business, index=c("NACE1", "NACE2"), vSize="employees", title.legend="number of NACE4 categories", type="value") # comparisson treemaps: colors indicate change of vSize with respect to vColor treemap(business, index=c("NACE1", "NACE2"), vSize="employees", vColor="employees.prev", type="comp") # density treemaps: colors indicate density (like a population density map) treemap(business, index=c("NACE1", "NACE2"), vSize="turnover", vColor="employees/1000", type="dens") ## Not run: # depth treemap: show depth treemap(business, index=c("NACE1", "NACE2", "NACE3"), vSize="turnover", type="depth") ## End(Not run) # categorical treemap: colors are determined by a categorical variable business <- transform(business, data.available = factor(!is.na(turnover)), x = 1) treemap(business, index=c("NACE1", "NACE2"), vSize="x", vColor="data.available", type="categorical") ## Not run: # color treemap business$color <- rainbow(nlevels(business$NACE2))[business$NACE2] treemap(business, index=c("NACE1", "NACE2"), vSize="x", vColor="color", type="color") # manual business$color <- rainbow(nlevels(business$NACE2))[business$NACE2] treemap(business, index=c("NACE1", "NACE2"), vSize="turnover", vColor="employees", type="manual", palette=terrain.colors(10)) ## End(Not run) ######################################### ### graphical options: control fontsizes ######################################### ## Not run: # draw labels of first index at fontsize 12 at the center, # and labels of second index at fontsize 8 top left treemap(business, index=c("NACE1", "NACE2"), vSize="employees", fontsize.labels=c(12, 8), align.labels=list(c("center", "center"), c("left", "top")), lowerbound.cex.labels=1) # draw all labels at fontsize 12 (only if they fit) treemap(business, index=c("NACE1", "NACE2"), vSize="employees", fontsize.labels=12, lowerbound.cex.labels=1) # draw all labels at fontsize 12, and if they don't fit, reduce to a minimum of .6*12 treemap(business, index=c("NACE1", "NACE2"), vSize="employees", fontsize.labels=12, lowerbound.cex.labels=.6) # draw all labels at maximal fontsize treemap(business, index=c("NACE1", "NACE2"), vSize="employees", lowerbound.cex.labels=0, inflate.labels = TRUE) # draw all labels at fixed fontsize, even if they don't fit treemap(business, index=c("NACE1", "NACE2"), vSize="employees", fontsize.labels=10, lowerbound.cex.labels=1, force.print.labels=TRUE) ######################################### ### graphical options: color palettes ######################################### ## for comp and value typed treemaps all diverging brewer palettes can be chosen treemap(business, index=c("NACE1", "NACE2"), vSize="employees", vColor="employees.prev", type="comp", palette="RdBu") ## draw warm-colored index treemap palette.HCL.options <- list(hue_start=270, hue_end=360+150) treemap(business, index=c("NACE1", "NACE2"), vSize="employees", type="index", palette.HCL.options=palette.HCL.options) # terrain colors business$employees.growth <- business$employees - business$employees.prev treemap(business, index=c("NACE1", "NACE2"), vSize="employees", vColor="employees.growth", type="value", palette=terrain.colors(10)) # Brewer's Red-White-Grey palette reversed with predefined legend range treemap(business, index=c("NACE1", "NACE2"), vSize="employees", vColor="employees.growth", type="value", palette="-RdGy", range=c(-20000,30000)) # More control over the color palette can be achieved with mapping treemap(business, index=c("NACE1", "NACE2"), vSize="employees", vColor="employees.growth", type="value", palette="RdYlGn", range=c(-20000,30000), # this is shown in the legend mapping=c(-30000, 10000, 40000)) # Rd is mapped to -30k, Yl to 10k, and Gn to 40k ## End(Not run)
######################################### ### quick example with Gross National Income data ######################################### data(GNI2014) treemap(GNI2014, index=c("continent", "iso3"), vSize="population", vColor="GNI", type="value", format.legend = list(scientific = FALSE, big.mark = " ")) ######################################### ### extended examples with fictive business statistics data ######################################### data(business) ######################################### ### treemap types ######################################### # index treemap: colors are determined by the index argument ## Not run: # large example which takes some time... treemap(business, index=c("NACE1", "NACE2", "NACE3"), vSize="turnover", type="index") ## End(Not run) treemap(business[business$NACE1=="C - Manufacturing",], index=c("NACE2", "NACE3"), vSize=c("employees"), type="index") # value treemap: colors are derived from a numeric variable given by vColor # (when omited, all values are set to 1 as in the following example) treemap(business, index=c("NACE1", "NACE2"), vSize="employees", title.legend="number of NACE4 categories", type="value") # comparisson treemaps: colors indicate change of vSize with respect to vColor treemap(business, index=c("NACE1", "NACE2"), vSize="employees", vColor="employees.prev", type="comp") # density treemaps: colors indicate density (like a population density map) treemap(business, index=c("NACE1", "NACE2"), vSize="turnover", vColor="employees/1000", type="dens") ## Not run: # depth treemap: show depth treemap(business, index=c("NACE1", "NACE2", "NACE3"), vSize="turnover", type="depth") ## End(Not run) # categorical treemap: colors are determined by a categorical variable business <- transform(business, data.available = factor(!is.na(turnover)), x = 1) treemap(business, index=c("NACE1", "NACE2"), vSize="x", vColor="data.available", type="categorical") ## Not run: # color treemap business$color <- rainbow(nlevels(business$NACE2))[business$NACE2] treemap(business, index=c("NACE1", "NACE2"), vSize="x", vColor="color", type="color") # manual business$color <- rainbow(nlevels(business$NACE2))[business$NACE2] treemap(business, index=c("NACE1", "NACE2"), vSize="turnover", vColor="employees", type="manual", palette=terrain.colors(10)) ## End(Not run) ######################################### ### graphical options: control fontsizes ######################################### ## Not run: # draw labels of first index at fontsize 12 at the center, # and labels of second index at fontsize 8 top left treemap(business, index=c("NACE1", "NACE2"), vSize="employees", fontsize.labels=c(12, 8), align.labels=list(c("center", "center"), c("left", "top")), lowerbound.cex.labels=1) # draw all labels at fontsize 12 (only if they fit) treemap(business, index=c("NACE1", "NACE2"), vSize="employees", fontsize.labels=12, lowerbound.cex.labels=1) # draw all labels at fontsize 12, and if they don't fit, reduce to a minimum of .6*12 treemap(business, index=c("NACE1", "NACE2"), vSize="employees", fontsize.labels=12, lowerbound.cex.labels=.6) # draw all labels at maximal fontsize treemap(business, index=c("NACE1", "NACE2"), vSize="employees", lowerbound.cex.labels=0, inflate.labels = TRUE) # draw all labels at fixed fontsize, even if they don't fit treemap(business, index=c("NACE1", "NACE2"), vSize="employees", fontsize.labels=10, lowerbound.cex.labels=1, force.print.labels=TRUE) ######################################### ### graphical options: color palettes ######################################### ## for comp and value typed treemaps all diverging brewer palettes can be chosen treemap(business, index=c("NACE1", "NACE2"), vSize="employees", vColor="employees.prev", type="comp", palette="RdBu") ## draw warm-colored index treemap palette.HCL.options <- list(hue_start=270, hue_end=360+150) treemap(business, index=c("NACE1", "NACE2"), vSize="employees", type="index", palette.HCL.options=palette.HCL.options) # terrain colors business$employees.growth <- business$employees - business$employees.prev treemap(business, index=c("NACE1", "NACE2"), vSize="employees", vColor="employees.growth", type="value", palette=terrain.colors(10)) # Brewer's Red-White-Grey palette reversed with predefined legend range treemap(business, index=c("NACE1", "NACE2"), vSize="employees", vColor="employees.growth", type="value", palette="-RdGy", range=c(-20000,30000)) # More control over the color palette can be achieved with mapping treemap(business, index=c("NACE1", "NACE2"), vSize="employees", vColor="employees.growth", type="value", palette="RdYlGn", range=c(-20000,30000), # this is shown in the legend mapping=c(-30000, 10000, 40000)) # Rd is mapped to -30k, Yl to 10k, and Gn to 40k ## End(Not run)
Obtain hierarchical color palettes, either the so-called Tree Colors from the HCL color space model, or by using an existing color palette. The former method, which is recommended, is used by default in treemap
(type "index"
) and treegraph
. Use treecolors
to experiment with this method.
treepalette( dtf, index = names(dtf), method = "HCL", palette = NULL, palette.HCL.options, return.parameters = TRUE, prepare.dat = TRUE )
treepalette( dtf, index = names(dtf), method = "HCL", palette = NULL, palette.HCL.options, return.parameters = TRUE, prepare.dat = TRUE )
dtf |
a data.frame or data.table. Required. |
index |
the index variables of dtf |
method |
used method: either |
palette |
color palette, which is only used for the HSV method |
palette.HCL.options |
list of options to obtain Tree Colors from the HCL space (when
For "depth" and "categorical" types, only the first two items are used. Use |
return.parameters |
should a data.frame with color values and parameter options be returned ( |
prepare.dat |
data is by default preprocessed, except for interal use |
Either a vector of colors, or a data.frame is return (see return.parameters
).