Skip to content

Commit 33968cc

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 65342b3 commit 33968cc

File tree

7 files changed

+1045
-1046
lines changed

7 files changed

+1045
-1046
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,3 @@ repos:
4343
# language: system
4444
# types: [python]
4545
# args: ["--fail-under=7.0","--max-line-length=120"]
46-

docs/overview.Rmd

Lines changed: 437 additions & 438 deletions
Large diffs are not rendered by default.

docs/overview.html

Lines changed: 141 additions & 141 deletions
Large diffs are not rendered by default.

docs/overview.nb.html

Lines changed: 119 additions & 119 deletions
Large diffs are not rendered by default.

map-experiments.Rmd

Lines changed: 59 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "General statistical overviews of FILTER data"
33
date: "`r Sys.Date()`"
4-
output:
4+
output:
55
html_notebook:
66
code_folding: hide
77
toc: yes
@@ -11,110 +11,111 @@ output:
1111
---
1212

1313
```{r setup, include=FALSE}
14-
knitr::opts_chunk$set(message=FALSE,dpi=300,fig.retina=2,fig.width=8)
14+
knitr::opts_chunk$set(message = FALSE, dpi = 300, fig.retina = 2, fig.width = 8)
1515
source(here::here("src/common_basis.R"))
1616
tmap_mode("plot")
1717
```
1818

1919
```{r}
20-
polygons %>%
21-
filter(map_id==1) %>%
20+
polygons %>%
21+
filter(map_id == 1) %>%
2222
left_join(p_pl %>% count(pl_id) %>% collect()) %>%
23-
replace_na(list(n=0)) %>%
23+
replace_na(list(n = 0)) %>%
2424
group_by(pol_id, geometry) %>%
25-
summarise(n=sum(n)) %>%
25+
summarise(n = sum(n)) %>%
2626
tm_shape() +
27-
tm_polygons(col='n', id='name', style='fisher', palette='plasma') +
28-
tm_layout(main.title="Exp-1")
27+
tm_polygons(col = "n", id = "name", style = "fisher", palette = "plasma") +
28+
tm_layout(main.title = "Exp-1")
2929
```
3030

3131
```{r}
32-
polygons %>%
33-
filter(map_id==0) %>%
32+
polygons %>%
33+
filter(map_id == 0) %>%
3434
left_join(p_pl %>% count(pl_id) %>% collect()) %>%
3535
group_by(pol_id, geometry) %>%
36-
summarise(n=sum(n)) %>%
36+
summarise(n = sum(n)) %>%
3737
tm_shape() +
38-
tm_polygons(col='n', id='name', style='fisher', palette='plasma') +
39-
tm_layout(main.title="Exp-1")
38+
tm_polygons(col = "n", id = "name", style = "fisher", palette = "plasma") +
39+
tm_layout(main.title = "Exp-1")
4040
```
4141

4242
```{r}
43-
polygons %>%
44-
filter(map_id==0) %>%
43+
polygons %>%
44+
filter(map_id == 0) %>%
4545
left_join(p_pl %>% count(pl_id) %>% collect()) %>%
4646
group_by(pol_id, geometry) %>%
47-
summarise(n=sum(n)) %>%
47+
summarise(n = sum(n)) %>%
4848
tm_shape() +
4949
tm_polygons() +
50-
tm_bubbles(size = "n", col="n") +
51-
tm_layout(main.title="Exp-1")
50+
tm_bubbles(size = "n", col = "n") +
51+
tm_layout(main.title = "Exp-1")
5252
```
5353
```{r}
54-
polygons %>%
55-
filter(map_id==1) %>%
54+
polygons %>%
55+
filter(map_id == 1) %>%
5656
left_join(p_pl %>% count(pl_id) %>% collect()) %>%
57-
replace_na(list(n=0)) %>%
57+
replace_na(list(n = 0)) %>%
5858
group_by(pol_id, geometry) %>%
59-
summarise(n=sum(n)) %>%
60-
tm_shape(point.per="largest") +
59+
summarise(n = sum(n)) %>%
60+
tm_shape(point.per = "largest") +
6161
tm_polygons() +
62-
tm_bubbles(size = "n", col="n") +
63-
tm_layout(main.title="Exp-1")
62+
tm_bubbles(size = "n", col = "n") +
63+
tm_layout(main.title = "Exp-1")
6464
```
6565

6666
```{r}
67-
d <- polygons %>%
68-
filter(map_id==0) %>%
67+
d <- polygons %>%
68+
filter(map_id == 0) %>%
6969
left_join(p_pl %>% inner_join(poems) %>% count(collection, pl_id) %>% collect()) %>%
70-
replace_na(list(n=0)) %>%
70+
replace_na(list(n = 0)) %>%
7171
group_by(collection, pol_id, geometry) %>%
72-
summarise(n=sum(n)) %>%
72+
summarise(n = sum(n)) %>%
7373
group_by(pol_id) %>%
74-
mutate(tn=sum(n)) %>%
74+
mutate(tn = sum(n)) %>%
7575
ungroup() %>%
76-
mutate(pol_id=str_c("p", pol_id), collection=as_factor(collection))
76+
mutate(pol_id = str_c("p", pol_id), collection = as_factor(collection))
7777
7878
plot_cols <- coloropt_pal()(4)
7979
80-
grps <- d %>%
81-
# filter(!is.na(n)) %>%
82-
complete(nesting(pol_id,tn,geometry),collection,fill=list(n=0)) %>%
83-
group_by(pol_id)
84-
grobs <- grps %>%
85-
group_map(~ggplotGrob(ggplot(.x, aes(x="", y=n, fill=collection)) +
86-
geom_col(width=1) +
87-
scale_y_continuous(expand=c(0,0)) +
88-
scale_fill_manual(values=plot_cols) +
89-
theme_ps(plot.axes = FALSE))
90-
) %>%
80+
grps <- d %>%
81+
# filter(!is.na(n)) %>%
82+
complete(nesting(pol_id, tn, geometry), collection, fill = list(n = 0)) %>%
83+
group_by(pol_id)
84+
grobs <- grps %>%
85+
group_map(~ ggplotGrob(ggplot(.x, aes(x = "", y = n, fill = collection)) +
86+
geom_col(width = 1) +
87+
scale_y_continuous(expand = c(0, 0)) +
88+
scale_fill_manual(values = plot_cols) +
89+
theme_ps(plot.axes = FALSE))) %>%
9190
set_names(group_keys(grps) %>% pull())
9291
```
9392

9493

9594
```{r,fig.width=10,fig.height=14}
9695
d %>%
97-
distinct(pol_id,geometry,tn) %>%
98-
tm_shape(point.per="largest") +
96+
distinct(pol_id, geometry, tn) %>%
97+
tm_shape(point.per = "largest") +
9998
tm_polygons() +
100-
tm_symbols(shape="pol_id",
101-
shapes=grobs,
102-
size="tn",
103-
legend.shape.show = FALSE,
104-
legend.size.is.portrait = TRUE,
105-
shapes.legend = 22) +
106-
tm_add_legend(type="fill",
107-
col=plot_cols,
108-
labels=c("erab", "jr", "literary", "skvr"),
109-
title="Collection")
110-
99+
tm_symbols(
100+
shape = "pol_id",
101+
shapes = grobs,
102+
size = "tn",
103+
legend.shape.show = FALSE,
104+
legend.size.is.portrait = TRUE,
105+
shapes.legend = 22
106+
) +
107+
tm_add_legend(
108+
type = "fill",
109+
col = plot_cols,
110+
labels = c("erab", "jr", "literary", "skvr"),
111+
title = "Collection"
112+
)
111113
```
112114

113115
```{r}
114116
d %>%
115117
tm_shape() +
116118
tm_polygons() +
117-
tm_bubbles(size="n") +
118-
tm_facets(by="collection",ncol=4)
119+
tm_bubbles(size = "n") +
120+
tm_facets(by = "collection", ncol = 4)
119121
```
120-

0 commit comments

Comments
 (0)