treemap: Treemap Visualization

Treemapの可視化

> library(treemap)
Warning: replacing previous import by 'grid::arrow' when loading 'treemap'
Warning: replacing previous import by 'grid::unit' when loading 'treemap'
> data("GNI2010")
> data("business")

バージョン: 2.4


関数名 概略
GNI2010 GNI 2010 Data
business Fictitious Business Statistics Data
itreemap Interactive user interface for treemap
random.hierarchical.data Create random hierarchical data
tmPlot Create a treemap (deprecated)
treecolors Interactive tool to experiment with Tree Colors
treegraph Create a tree graph
treemap Create a treemap
treemap-package Treemap package
treepalette Obtain hierarchical color palettes (Tree Colors)

GNI2010

> data("GNI2010")
> GNI2010 %>% {
+   class(.) %>% print()
+   dplyr::glimpse(.)
+ }
[1] "data.frame"
Observations: 208
Variables: 5
$ iso3       (chr) "ABW", "AFG", "AGO", "ALB", "ARE", "ARG", "ARM", "A...
$ country    (chr) "Aruba", "Afghanistan", "Angola", "Albania", "Unite...
$ continent  (chr) "North America", "Asia", "Africa", "Europe", "Asia"...
$ population (dbl) 108, 34385, 19082, 3205, 7512, 40412, 3092, 68, 88,...
$ GNI        (dbl) 0, 410, 3960, 3960, 0, 8620, 3200, 0, 13280, 46200,...

business

> data("business")
> business %>% {
+   class(.) %>% print()
+   dplyr::glimpse(.)
+ }
[1] "data.frame"
Observations: 603
Variables: 9
$ NACE1          (fctr) A - Agriculture, forestry and fishing, A - Agr...
$ NACE2          (fctr) 01 - Crop and animal production, hunting and r...
$ NACE3          (fctr) 01.1 - Growing of non-perennial crops, 01.1 - ...
$ NACE4          (fctr) 01.1.1 - Growing of cereals (except rice), leg...
$ NACE.code      (fctr) 0111, 0113, 0116, 0119, 0121, 0124, 0125, 0127...
$ turnover       (dbl) NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
$ employees      (dbl) NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
$ turnover.prev  (dbl) NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...
$ employees.prev (dbl) NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,...

itreemap

インタラクティブな操作でtreempaを描画する

> data("business")
> itreemap(business)

random.hierarchical.data

> random.hierarchical.data(200) %>% 
+   treemap(index = names(.)[1:(ncol(.) - 1)], vSize = "x")

treemap

> treemap(GNI2010,
+        index  = c("continent", "iso3"),
+        vSize  = "population",
+        vColor = "GNI",
+        type   = "value")
> 
> treemap(iris,
+         index = c("Species"),
+         vSize = "Sepal.Length",
+         vColor = "Petal.Width",
+         type   = "value")