add_ist: Add Series

Description Usage Arguments Details See Also Examples

View source: R/add.R

Description

Add series(s) to chart

Usage

1
add_ist(p, values, name, ...)

Arguments

p

a chartist object.

values

values to plot on y axis.

name

name the serie, see details (optional).

...

Additional parameter.

Details

Naming the serie (name) is useful if you want to apply different options (opt_ist) for each serie later on. If no name is specified then the assigns one; type + i where i is the serie index and starts from 1. Names can be retrieved using name_ist. See examples.

See Also

name_ist, opt_ist

Examples

 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
# basic example
mtcars[1:10,] %>%
  chart_ist(x = mpg) %>%
  add_ist(disp) %>%
  add_ist(hp)

# option applies to both "disp" and "hp"
mtcars[1:10,] %>%
  chart_ist(x = mpg) %>%
  add_ist(disp) %>%
  add_ist(hp) %>%
  opt_ist(showArea = TRUE)

# use names to apply different option to each serie
mtcars[1:10,] %>%
  chart_ist(x = mpg) %>%
  add_ist(disp, name = "disp") %>%
  add_ist(hp, name = "hp") %>%
  opt_ist(name = "hp", showArea = TRUE, showPoint = FALSE) %>%
  opt_ist(name = "disp", lineSmoothing = "step")

# if you haven't assigned names you can retrieve generated ones with name_ist
# See details for generated names logic
mtcars[1:10,] %>%
  chart_ist(x = mpg) %>%
  add_ist(disp, name = "disp") %>%
  add_ist(hp, name = "hp") %>%
  name_ist()

JohnCoene/chartist documentation built on May 7, 2019, 11:17 a.m.