-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy path05_highlighting_ones_ranking.Rmd
55 lines (44 loc) · 1.65 KB
/
05_highlighting_ones_ranking.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
name: ratings
# Highlighting among ratings
Fine tuning a plot.
Compare the following plot to other possible ways of displaying similar data: https://twitter.com/FILWD/status/1060212703636217856
```{r, echo = F}
# create some toy data
outcome <- rnorm(20)
cat <- paste("Feature", rep(LETTERS[1:4],5))
company <- paste("Company", sort(rep(letters[1:5], 4)))
df <- tibble(outcome,cat,company) %>%
group_by(cat) %>%
arrange(desc(outcome)) %>%
mutate(rank = 1:n())
```
---
```{r company_ranks, echo = F, eval = F}
ggplot(df) +
aes(x = rank) +
aes(y = outcome) +
geom_point(size = 2) +
facet_grid(. ~ cat) +
aes(col = company) +
aes(shape = company) +
aes(size = company) +
labs(x = "Rank for among companies for feature") +
scale_color_manual(name = "",
values = c("steelblue", "darkgrey",
"darkgrey", "darkgrey",
"darkgrey")) +
scale_shape_discrete(name = "") +
theme_bw(base_family = "Times") +
labs(title = "Average Score and Ranks across features exercise w/ R & ggplot2") +
labs(subtitle = "Data Source: Randomly generated toy data in R | Viz: Gina Reynolds") +
labs(y = "Average Score") +
scale_x_continuous(breaks = 1:5, labels = 1:5,
limits = c(.5, 5.5))
```
```{r, echo = F, warning=F, message=F, eval = T, fig.show='hide'}
get_what_save_what <- "company_ranks"
eval(parse(text = paste(knitr:::knit_code$get(get_what_save_what), collapse = "")))
ggsave(paste0("figures/", get_what_save_what, ".png"), dpi = 300)
```
`r apply_reveal("company_ranks")`
---