bar_theme: Bar plot themes

Description Usage Arguments Author(s) See Also Examples

Description

Bar plot themes

Usage

1
bar_theme(base_size = 10, orientation = c("vertical", "horizontal"))

Arguments

base_size

Sent to theme_bw.

orientation

Is it a vertical or horizontal bar plot?

Author(s)

Christofer Bäcklin

See Also

tmt_theme.

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
library(ggplot2)
library(grid)
library(gridExtra)

plot_data <- data.frame(
  Language = c("French", "German", "Italian", "Spanish", "Swedish"),
  Estimate = c(4.123, 5.12, 2.312, 3.83, 2.48)
)

p_default <- ggplot(plot_data, aes(x = Language, y = Estimate)) +
  geom_bar(stat = "identity") +
  scale_y_continuous(expand = c(0, 0))

p_default +
  coord_flip() +
  #tmt_label(aes(label = Estimate), nudge_y = .3) +
  expand_limits(y = c(0, 6)) +
  bar_theme(orientation = "hor")

grid.arrange(
  p_default,
  p_default + bar_theme(),
  p_default + coord_flip(),
  p_default + coord_flip() + bar_theme(orientation = "horizontal"),
  nrow = 2, ncol = 2
)

backlin/treesmapstheorems documentation built on May 11, 2019, 5:23 p.m.