i_geom_tile_prop_over_time_text: Percentage labels the are filled according to proportion...

Description Usage Arguments Examples

View source: R/i_geom_prop_label_in_ts.R

Description

Percentage labels the are filled according to proportion where total in x is denominator

Usage

1
2
3
4
5
6
7
8
9
i_geom_tile_prop_over_time_text(
  mapping = NULL,
  data = NULL,
  position = "identity",
  na.rm = FALSE,
  show.legend = NA,
  inherit.aes = TRUE,
  ...
)

Arguments

...

Examples

 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
library(ggplot2)
library(magrittr)
gapminder::gapminder %>%
dplyr::mutate(gdp = gdpPercap * pop) %>%
ggplot() +
  aes(x = year) +
  aes(y = continent) +
  geom_tile_prop_over_time() +
  aes(fill = gdp) +
  scale_fill_viridis_c() +
  aes(label = gdp) +
  geom_tile_prop_over_time_text()

gapminder::gapminder %>%
dplyr::mutate(gdp = gdpPercap * pop) %>%
ggplot() +
  aes(x = year) +
  aes(y = continent) +
  geom_tile_prop_over_time() +
  aes(fill = gdp) +
  scale_fill_viridis_c() +
  aes(label = gdp) +
  geom_tile_prop_over_time_text(size = 2, angle = -90,
                                color = "snow") +
  facet_wrap(facets = vars(pop > 1000000))

gapminder::gapminder %>%
ggplot() +
  aes(x = year) +
  aes(y = continent) +
  aes(fill = 1, label = 1) + # use 1 to count times continent is observed
  geom_tile_prop_over_time(color = "oldlace") +
  labs(fill = "proportion\nof countries\nin each time\nperiod") +
  i_geom_tile_prop_over_time_text(size = 3) +
  facet_wrap(facets = vars(ifelse(gdpPercap > 10000,
  "gdp per cap > 10000", "gdp per cap < 10000")),
  ncol = 1) +
  scale_fill_viridis_c()

EvaMaeRey/ggextend documentation built on Dec. 17, 2021, 7:24 p.m.