ggtetris: Creates a tetris visualization using ggplot2

Description Usage Arguments Value Examples

Description

This function creates a chart where the number in each group is represented by a collection of connected squares proportional to the number in that group. In this function the group counts are supplied as input.

Usage

1
2
ggtetris(data, colunms = 10, xlab = NULL, colors = NA, line_color = NA,
  title = NULL)

Arguments

data

Numerical vector of counts, named or otherwise or data.frame with a name column and a count column.

colunms

Numeric. Number of colunms.

xlab

text for below the chart.

colors

Same number of colors as values in data. If omitted, Color Brewer "Set3" colors are used.

line_color

Color of the outline of the polygons in the chart. Defaults to grey.

title

Character. chart title.

Value

ggplot objects.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
nums <- c(25, 13, 12, 7, 43)
ggtetris(data = nums)

ggtetris(rep(6, 12), colunms = 8)

ggtetris(c('AA' = 30, 'BB' = 23, 'CC' = 10))

ggtetris(
  data.frame(
    names = LETTERS[1:4],
    vals = c(80, 30, 20, 10)
    ), colunms = 8
 )

 raw_data <- rpois(100, lambda = 1)
 counts <- table(raw_data)
 ggtetris(counts)

EmilHvitfeldt/ggtetris documentation built on May 29, 2019, 2:48 p.m.