This has never been an issue before, but recently when I try to produce treemaps (using the R treemap package) that have rectangles ordered by value I'm unable to do so. Rather rectangles are ordered alphabetically by index name. Have I misunderstood the recent documentation at any point or is this a non-reproducible issue (one to do with my package install)?
Reproducible example below. The resulting treemap is alphabetically ordered when I want it ordered by 'vals' size
library(treemap)
names <- as.character(c("a", "c", "b", "d"))
vals <- c(10, 20, 65, 5)
tree_ex <- as.data.frame(cbind(names, vals), )
tree_ex$vals <- as.numeric(as.character(tree_ex$vals))
treemap(tree_ex, index='names', vSize = "vals",
algorithm = "pivotSize",
sortID = "vals")
The package is broken. Reproducible example below. See also Issue #30 which I have just filed on github for treemap package
Code to reproduce the broken behaviour:
# create data set
set.seed(1234)
df <- data.frame(A=LETTERS[1:12],size=seq(12,1),sort=sample(12))
# install the last version with sortID respected and plot treemap
devtools::install_github("treemap", user="mtennekes", subdir="pkg",ref="5ca7c0b562e4a60bab111752210d6aba8995f55a")
library(treemap)
treemap(df,index="A",vSize="size",algorithm="pivotSize",sortID="sort")
# install the version which breaks sortID and plot treemap
devtools::install_github("treemap", user="mtennekes", subdir="pkg",ref="d8817db2805058f6a36db9f882790681961bc052")
library(treemap)
treemap(df,index="A",vSize="size",algorithm="pivotSize",sortID="sort")
UPDATE 2016-03-23
Package fixed Commit 0224354