#------------------------------------------------图7-3-2 树状图(a)----------------------------------------------------------------------
library(treemap)
library(RColorBrewer)
proglangs <- read.csv("Treemap_Data.csv ")
treemap(proglangs,
index=c("parent", "id"),
vSize="value",
vColor="parent",
type="index",
border.lwds=c(2,0.1),
fontcolor.labels=c('white',"grey10"),
title="",
align.labels = list(c("center", "center"), c("right", "bottom")),
fontsize.labels=c(12, 9),
palette="Set1")
treemap(proglangs,
index=c("parent", "id"),
vSize="value",
vColor="parent",
type="index",
border.lwds=c(2,0.1),
fontcolor.labels=c('white',"grey10"),
title="",
align.labels = list(c("center", "center"), c("right", "bottom")),
fontsize.labels=c(12, 9),
palette="Set2")
treemap(proglangs,
index=c("parent", "id"),
vSize="value",
vColor="parent",
type="index",
border.lwds=c(2,0.1),
fontcolor.labels=c('white',"grey10"),
title="",
align.labels = list(c("center", "center"), c("right", "bottom")),
fontsize.labels=c(12, 9),
palette="Set3")
treemap(proglangs,
index=c("parent", "id"),
vSize="value",
vColor="parent",
type="index",
border.lwds=c(2,0.1),
fontcolor.labels=c('white',"grey10"),
title="",
align.labels = list(c("center", "center"), c("right", "bottom")),
fontsize.labels=c(12, 9),
palette="Paired")
treemap(proglangs,
index=c("parent", "id"),
vSize="value",
vColor="parent",
type="index",
border.lwds=c(2,0.1),
fontcolor.labels=c('white',"grey10"),
title="",
align.labels = list(c("center", "center"), c("right", "bottom")),
fontsize.labels=c(12, 9),
palette="Pastel1")
开发工具:RStudio与Alt+A快捷截屏工具