File: spark_bar.Rd

package info (click to toggle)
r-cran-cli 3.6.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,288 kB
  • sloc: ansic: 16,412; cpp: 37; sh: 13; makefile: 2
file content (59 lines) | stat: -rw-r--r-- 2,487 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spark.R
\name{spark_bar}
\alias{spark_bar}
\title{Draw a sparkline bar graph with unicode block characters}
\usage{
spark_bar(x)
}
\arguments{
\item{x}{A numeric vector between 0 and 1}
}
\description{
Rendered using \href{https://en.wikipedia.org/wiki/Block_Elements}{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 \code{\link[=is_utf8_output]{is_utf8_output()}} to test for support
for them.
}
\details{
\if{html}{\out{<div class="sourceCode r">}}\preformatted{x <- seq(0, 1, length = 6)
spark_bar(x)
}\if{html}{\out{</div>}}\if{html}{\out{
<div class="asciicast" style="color: #172431;font-family: 'Fira Code',Monaco,Consolas,Menlo,'Bitstream Vera Sans Mono','Powerline Symbols',monospace;line-height: 1.300000"><pre>
#> ▁▂▄▅▇█                                                                          
</pre></div>
}}


\if{html}{\out{<div class="sourceCode r">}}\preformatted{x <- seq(0, 1, length = 6)
spark_bar(sample(x))
}\if{html}{\out{</div>}}\if{html}{\out{
<div class="asciicast" style="color: #172431;font-family: 'Fira Code',Monaco,Consolas,Menlo,'Bitstream Vera Sans Mono','Powerline Symbols',monospace;line-height: 1.300000"><pre>
#> ▅▁█▄▇▂                                                                          
</pre></div>
}}


\if{html}{\out{<div class="sourceCode r">}}\preformatted{spark_bar(seq(0, 1, length = 8))
}\if{html}{\out{</div>}}\if{html}{\out{
<div class="asciicast" style="color: #172431;font-family: 'Fira Code',Monaco,Consolas,Menlo,'Bitstream Vera Sans Mono','Powerline Symbols',monospace;line-height: 1.300000"><pre>
#> ▁▂▃▄▅▆▇█                                                                        
</pre></div>
}}


\code{NA}s are left out:

\if{html}{\out{<div class="sourceCode r">}}\preformatted{spark_bar(c(0, NA, 0.5, NA, 1))
}\if{html}{\out{</div>}}\if{html}{\out{
<div class="asciicast" style="color: #172431;font-family: 'Fira Code',Monaco,Consolas,Menlo,'Bitstream Vera Sans Mono','Powerline Symbols',monospace;line-height: 1.300000"><pre>
#> ▁ ▄ █                                                                           
</pre></div>
}}
}
\seealso{
\code{\link[=spark_line]{spark_line()}}
}