dk_theme: DataKind ggplot2 Theme

Description Usage Format Examples

Description

A ggplot2 theme object to make creating plots and visualisations simpler and easier. Just add "+ dk_theme" when building your plot layers.

Usage

1

Format

A list with a ggplot2 object data.

dk_theme

ggplot2 theme object

scale_colour_manual

modifies the default colours to datakind palette

scale_fill_manual

modifies the default fill colours to datakind palette

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
## Not run: 
ggplot2::ggplot(data.frame( y = runif(100, min = 0, max = 20) +
  seq(1, 100, 1),
  x = seq(1, 100, 1),
  z = rep_len(c("a", "b", "c", "d"), 100)),
  ggplot2::aes(x, y, colour = z, fill = z)) +
  ggplot2::geom_point() +
  ggplot2::facet_wrap(~z, nrow = 2) +
  ggplot2::geom_smooth(se = TRUE) +
  ggplot2::labs(title = "Some Data (2011)",
      x = "Range", y = "Value") +
  dk_theme +
  ggplot2::scale_fill_manual(values = dk_sequential_palette)

ggplot2::ggplot(data.frame( x = c('Primary 1', 'Primary 2',
                                 'Secondary 1', 'Secondary 2'),
                           y = runif(4, 10, 100)),
               ggplot2::aes(x,y, fill = x)) +
  ggplot2::geom_bar(stat = "identity") +
  ggplot2::labs(title = "Some Data (2011)",
                x = "Range", y = "Value") +
  dk_theme
  
## End(Not run)

cormac85/datakindr documentation built on May 13, 2019, 1:36 a.m.