spark_bar: Draw a sparkline bar graph with unicode block characters

Description Usage Arguments Examples

Description

Rendered using block elements. In most common fixed width fonts these are rendered wider than regular characters which means they are not suitable if you need precise alignment. Based on the function in the pillar package.

Usage

1
spark_bar(x, safe = TRUE)

Arguments

x

A numeric vector between 0 and 1

safe

Nominally there are 8 block elements from 1/8 height to full height (8/8). However, the half-height and full-height blocks appear to be rendered inconsistently (possibly due to font substitution).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
x <- seq(0, 1, length = 6)
spark_bar(x)
spark_bar(sample(x))

# This might work if you're lucky
spark_bar(seq(0, 1, length = 8), safe = FALSE)

spark_bar(c(0, NA, 0.5, NA, 1))

## End(Not run)

MyersGroup/MotifFinder documentation built on June 7, 2019, 3:42 p.m.