-
Notifications
You must be signed in to change notification settings - Fork 0
/
growing_collection_dashboard.Rmd
131 lines (111 loc) · 4.27 KB
/
growing_collection_dashboard.Rmd
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
---
title: "The Met's Growing Collection"
output:
flexdashboard::flex_dashboard:
orientation: rows
theme: cosmo
navbar:
- { icon: "fa-home", href: "./index.html", align: right }
---
```{r setup, include = FALSE}
library(tidyverse)
library(flexdashboard)
library(plotly)
load("data/met.RData")
mypal = c("#78B7C5", "#EBCC2A", "#FF0000", "#EABE94",
"#3B9AB2", "#B40F20", "#0B775E", "#F2300F",
"#5BBCD6", "#F98400", "#ab0213", "#E2D200",
"#ff7700", "#46ACC8", "#00A08A", "#78B7C5",
"#a7ba42", "#f94f8a", "#DD8D29")
```
Row {data-height=50}
-------------------------------------
This line chart shows the number of objects accessed by each department of the Met over time. Double click on a department in the right-hand legend to isolate its trend on the chart. You can also drag your mouse over regions of the timeline that you would like to zoom in on.
Row {data-height=600}
-------------------------------------
### Number of objects by department over time
```{r}
met %>%
group_by(accession_year, department) %>%
summarize(n = n()) %>%
ungroup() %>%
arrange(department) %>%
plot_ly(
x = ~accession_year, y = ~n, type = 'scatter', mode = 'lines',
alpha = .9, color = ~department, colors = mypal,
hoverinfo = 'text',
text = ~paste("</br> Department: ", department, "</br> Year: ", accession_year, "</br> Number of objects: ", n)) %>%
layout(xaxis = list(title = "Year"),
yaxis = list (title = "Number of objects",
tickformat=","))
```
Row {data-height=50}
-------------------------------------
These three plots show "big" years in which departments at the Met had their highest number of objects, represented the highest number of unique cultures, or represented the highest number of (known) woman artists.
Row {data-height=500}
-------------------------------------
### Departments at their largest
```{r}
met %>%
group_by(department, accession_year) %>%
summarize(n = n()) %>%
select(department, accession_year, n) %>%
group_by(department) %>%
slice(which.max(n)) %>%
arrange(department) %>%
plot_ly(
y = ~n, x = ~accession_year, type = "scatter", mode = "markers",
size = ~I(n*1.5), alpha = .9,
color = ~department, colors = mypal,
hoverinfo = 'text',
text = ~paste("</br> Department: ", department, "</br> Year: ", accession_year, "</br> Number of objects: ", n)) %>%
layout(xaxis = list(title = "Year"),
yaxis = list (title = "Number of objects",
tickformat=",")) %>%
hide_legend()
```
### Departments at their most culturally diverse
```{r}
met %>%
filter(!is.na(culture)) %>%
mutate(culture = str_remove(culture, "possibly "),
culture = str_remove(culture, "probably ")) %>%
group_by(department, accession_year, .drop=FALSE) %>%
summarize(n = n_distinct(culture)) %>%
select(department, accession_year, n) %>%
group_by(department) %>%
slice(which.max(n)) %>%
arrange(department) %>%
plot_ly(
y = ~n, x = ~accession_year, type = "scatter", mode = "markers",
size = ~I(n*1.5), alpha = .9,
color = ~department, colors = mypal,
hoverinfo = 'text',
text = ~paste("</br> Department: ", department, "</br> Year: ", accession_year, "</br> Number of cultures: ", n)) %>%
layout(xaxis = list(title = "Year"),
yaxis = list (title = "Number of cultures",
tickformat=",")) %>%
hide_legend()
```
### Departments at their most representative of women artists
```{r}
met %>%
filter(!is.na(artist_gender)) %>%
mutate(woman = ifelse(grepl("Female", artist_gender), 1, 0)) %>%
group_by(department, accession_year) %>%
summarize(n_woman = sum(woman)) %>%
select(department, accession_year, n_woman) %>%
group_by(department) %>%
slice(which.max(n_woman)) %>%
arrange(department) %>%
plot_ly(
y = ~n_woman, x = ~accession_year, type = "scatter", mode = "markers",
size = ~I(n_woman*2), alpha = .9,
color = ~department, colors = mypal,
hoverinfo = 'text',
text = ~paste("</br> Department: ", department, "</br> Year: ", accession_year, "</br> Number of objects: ", n_woman)) %>%
layout(xaxis = list(title = "Year"),
yaxis = list (title = "Number of objects by women",
tickformat=",")) %>%
hide_legend()
```