plot_ggwaffle: Waffle Plot

Description Usage Arguments Value Resources Examples

View source: R/plot_ggwaffle.R

Description

Waffle Plot

Usage

1

Arguments

dp

List of parameters

  • tab: table to be plotted, aggregated values

  • key_label = ”: column name with plot labels

  • key_family = ”: column name with font family

  • key_frequ = ”: column name with frequencies

  • key_color = ”: column name with colors

  • key_group = ”: column name with groups

  • key_facet = ”: column name with facet groups

  • label = '\u25A0': labels to be plotted, only if key_label is not defined

  • family = NA: font family for labels, only if key_family is not defined

  • frequ = 1: frequency, only if key_frequ is not defined

  • color = '#bb873c': vector with colors, only if key_color is not defined

  • cols = 5: number of columns in waffle chart

  • size = 10: size of plotted labels

  • orientation = 'vertical': orientation of waffel plot pillars (vertical or horizontal)

  • align = 'bottom': alignment of waffle plot pillars (top, bottom, center). E.g. centered facet pillars

  • facet_ncol = 5: maximum number of facet columns

  • legend = 'none': legend position (top, right, left, bottom, none, label) 'label' uses labels as legend symbols, works only in some situations with position always right

  • legend_symbol_size = 3: size of legend symbols

  • legend_text_size = 15: size of legend text

  • label_legend_size = 10: size of label-legend symbols and text

  • label_legend_color = '#A9A9A9': color of label-legend text

  • facet_margin = 2: (-2 if legend = 'label'), inner margin between neighboring facets.

  • chart_xy_margin = 1: (3 if legend = 'label' to give enough space), extra xy-limit for each plot (increases x-axis limits)

  • margin_bottom = 1: to increase y-axis at bottom side

  • margin_top = 1: to increase y-axis at top side

  • outermargin_left = 0: chart margin left

  • outermargin_right = 1: chart margin right

  • facet_text_size = 25: size of facet title

  • facet_text_color = '#707070': color of facet title

  • facet_title_position = 'bottom': position of facet title (top, left, bottom, right)

  • font = ”: font family of chart

Value

a ggplot waffle chart

Resources

Unicode table: https://unicode-table.com/de/

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
## Not run: plot_ggwaffel(dp)
## Not run: 
dp = list(NULL)
dp$tab = tab
fplot = plot_ggwaffel(dp)
fplot

# -----------------------

library(emojifont)
library(mzfun)

tab1 = data.table(
  group = 'Chart 1',
  segment = c('A', 'B', 'C'),
  frequ = c(12, 13, 14),
  color = c('blue', 'green', 'grey'),
  label= fontawesome('fa-car'),
  family='fontawesome-webfont',
  label2 = emoji('airplane'),
  family2 ='EmojiOne'
)

tab2 = data.table(
  group = 'Chart 2',
  segment = c('A', 'B', 'C'),
  frequ = c(15, 16, 17),
  color = c('blue', 'green', 'grey'),
  label= fontawesome('fa-twitter'),
  family='fontawesome-webfont',
  label2 = emoji('airplane'),
  family2 ='EmojiOne'
)

tab3 = rbind(tab1, tab2)

dp = list(NULL)
dp$tab = tab3
dp$key_frequ = 'frequ'
dp$key_group = 'segment'
dp$key_facet = 'group'
dp$key_color = 'color'
dp$key_label = 'label'
dp$key_family = 'family'
#dp$label = fontawesome('fa-female')
#dp$family ='fontawesome-webfont'
#dp$label = 'a'
dp$size = 15
dp$cols = 4
dp$orientation = 'horizontal'
#dp$color = c('grey', 'black')
dp$facet_ncol = 1
dp$align = 'center'
dp$legend = 'label'
dp$facet_title_position = 'top'
dp$font = 'serif'
dp$facet_margin = 2

fplot = plot_ggwaffle(dp)
fplot

# ------------------------

dp$key_label = 'label2'
dp$key_family = 'family2'

fplot = plot_ggwaffle(dp)
fplot

## End(Not run)

mz74/mzfun documentation built on April 14, 2021, 4:17 a.m.