GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • cli
  • FAQ
  • Reference
  • Building a Semantic CLI
  • From usethis::ui functions to cli
  • cli pluralization
  • Introduction to progress bars in cli
  • Advanced cli progress bars
  • cli color palettes
  • More articles...
  • Changelog

This view

  • Original page
  • New address

GeezerVison is showing cli.r-lib.org — Draw a sparkline bar graph with unicode block characters — spark_bar

Draw a sparkline bar graph with unicode block characters

Source: R/spark.R
spark_bar.Rd

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)

#> ▁▂▄▅▇█

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

#> ▅▁█▄▇▂

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

#> ▁▂▃▄▅▆▇█

NAs are left out:

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

#> ▁ ▄ █

See also

spark_line()

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.