palette: Palettes and Palette Viewing

Description Usage Arguments Format Value See Also Examples

Description

hilighter_colors - A palette of 10 hilighter colors.

gradient_colors - A function to create a palette function of interpolated colors.

view_colors - Plots vector of colors.

assert_hex - Convert colors to hexadecimal.

map_colors - Add colors to a list to make a named list which is a map.

Usage

1
2
3
4
5
6
7
8
9

Arguments

x

A vector of colors (either R colors() or hexadecimal).

list

A list of matches for a map.

colors

A vector of colors.

Format

An object of class character of length 10.

Value

view_colors plots the colors as bars

assert_hex returns a vector of hexadecimal strings

map_colors returns a names list

See Also

colorRampPalette

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
view_colors(hilighter_colors)
view_colors(c("#FFA500", "#B3B3B3", "#FFFF00", 'red', 'blue', 'black'))
view_colors(gradient_colors(sort(hilighter_colors))(25))
## Not run: 
view_colors(gradient_colors(RColorBrewer::brewer.pal(9, 'Set1'))(30))

## End(Not run)

## Not run: 
library(tidyverse)

map_hilight <- list(
    c('\\bwe(\'[a-z]+)?\\b'),
    c('\\bhe(\'[a-z]+)?\\b'),
    'you',
    '\\bi(?=($|\\s))'
) %>%
    map_colors()

set.seed(10)
presidential_debates_2012 %>%
    dplyr::filter(person %in% c('ROMNEY', 'OBAMA')) %>%
    dplyr::group_by(person) %>%
    dplyr::sample_n(15) %$%
    hilight_term(dialogue, map_hilight, list(person)) %>%
    plot()

## End(Not run)

trinker/textplot documentation built on May 29, 2019, 1:38 p.m.