asciiPlot: ASCII chart of vector. Generate an ascii chart for a series...

Description Usage Arguments Value Examples

View source: R/plot.r

Description

asciiPlot returns a character string of a chart for given series.

Usage

1
asciiPlot(series, cfg = list())

Arguments

series

A numeric vector, missing data values in the series can be specified as a NA.

cfg

A named list with some options: height specifies the number of rows the graph should occupy. It can be used to scale down a graph with large data values. format specifies a C format string used to format the labels on the y-axis. The default value is " symbols provides a list of single characters to use for drawing the curve. offset changes what column will the y-axis be drawn. Default is 3. min and max will clamp the y-axis and all values.

Value

A character string

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
series <- c(1,2,3,4,4,3,2,1)
cat(asciiPlot(series))

series <- c(1,2,3,NA,4,3,NA,1)
cat(asciiPlot(series))

series <- c(1,2,3,4,NA,4,3,2,1)
cat(asciiPlot(series, list('min' = 0)))

## Not run: 
cat(asciiPlot(c(NA, NA)))

## End(Not run)

Example output

    4.00 ┤  ╭─╮   
    3.00 ┤ ╭╯ ╰╮  
    2.00 ┤╭╯   ╰╮ 
    1.00 ┼╯     ╰ 

    4.00 ┤   ╶╮   
    3.00 ┤ ╭╴ ╰╴  
    2.00 ┤╭╯      
    1.00 ┼╯     ╶ 

    4.00 ┤  ╭╴╶╮   
    3.00 ┤ ╭╯  ╰╮  
    2.00 ┤╭╯    ╰╮ 
    1.00 ┼╯      ╰ 
    0.00

asciichartr documentation built on July 2, 2020, 2:48 a.m.