-
Notifications
You must be signed in to change notification settings - Fork 0
/
Treemaps.R
42 lines (28 loc) · 835 Bytes
/
Treemaps.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
library(tidyverse)
library(ggplot2) # this is inside tidyverse
library(treemapify)
G20
G20 %>%
slice(rep(c(1:20), 20)) %>%
ggplot(aes(area=gdp_mil_usd, fill=region, subgroup=region))+
geom_treemap(
show.legend=F
)+
geom_treemap_subgroup_border(color="lightgrey", size=5,
show.legend=F
)+
scale_fill_brewer(palette = "Set3")
####
G20 %>%
ggplot(aes(area = Contig_Len, fill = Genome_Name, subgroup = Genome_Name)) +
geom_treemap(show.legend = FALSE) +
geom_treemap_subgroup_border(colour = "white", size = 5) +
scale_fill_brewer(palette = "Set3")
####
library(treemap)
G20 %>%
slice(rep(c(1:20), 50)) %>%
mutate(id = row_number()) %>%
treemap(index=c("region","id"),
vSize = "gdp_mil_usd",
type = "index")