R語言制作樹框圖

library(treemap)
data <- data.frame(City = c('shenyang','dalian','panjin','yingkou','liaoyang'),
??????????score = c(100,86,53,47,36))
palette <- c('#76D7C4','#76BAD7','#7689D7','#9376d7','#D776BA')
treemap(data,
????index='City',
????vSize='score',
????palette=palette,
????type='index')
group = c(rep("shenyang",4),rep('dalian',2),rep('panjin',3))
subgroup = c('rose','lily','violet','tulip','tiger','horse','apple','kiwi','grapes')
value = c(4,6,2,8,3,7,5,1,9)
data1 = data.frame(group,subgroup,value)
treemap(data1,
????index=c('group','subgroup'),
????vSize='value',
????palette=palette,
????type='index')
標(biāo)簽: