h_geom_tile_prop_over_time: Tiles the are filled according to proportion where total in x...

Description Usage Arguments Examples

View source: R/h_geom_prop_in_ts.R

Description

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

Usage

1
2
3
4
5
6
7
8
9
h_geom_tile_prop_over_time(
  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
# do it without function
library(tidyverse)
gapminder::gapminder %>%
  mutate(gdp = gdpPercap * pop) ->
my_gapminder

my_gapminder %>%
  group_by(year, continent) %>%
  summarise(gdp = sum(gdp)) %>%
  mutate(prop_gdp = gdp/sum(gdp)) %>%
  ggplot() +
  aes(x = year) +
  aes(y = continent) +
  geom_tile() +
  aes(fill = prop_gdp) +
  scale_fill_viridis_c()

# the function and proto
"StatPropovertime"
"StatPropovertimetext"

# use function
library(ggplot2)
library(magrittr)
my_gapminder %>%
ggplot() +
  aes(x = year) +
  aes(y = continent) +
  h_geom_tile_prop_over_time() +
  aes(fill = gdp) +
  scale_fill_viridis_c()

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