spark_bar {cli}R Documentation

Draw a sparkline bar graph with unicode block characters

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.

You might want to avoid sparklines on non-UTF-8 systems, because they do not look good. You can use is_utf8_output() to test for support for them.

Usage

spark_bar(x)

Arguments

x

A numeric vector between 0 and 1

Details

x <- seq(0, 1, length = 6)
spark_bar(x)

spark-bar-1.svg

x <- seq(0, 1, length = 6)
spark_bar(sample(x))

spark-bar-2.svg

spark_bar(seq(0, 1, length = 8))

spark-bar-3.svg

NAs are left out:

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

spark-bar-na.svg

See Also

spark_line()


[Package cli version 3.3.0 Index]