Learn R Programming

rAmCharts (version 2.1.16)

amLines: amLines adds a serie to a graph.

Description

amLines adds a new serie to an existing serial chart.

Usage

amLines(
  chart,
  x = NULL,
  y = NULL,
  type = c("points", "line", "smoothedLine", "both", "step"),
  col = "#0066cc",
  title,
  fill_alphas = 0,
  balloon = T
)

Arguments

chart

AmChart. Chart you wish to add the new serie.

x

numeric, equivalent to y, deprecated.

y

numeric.

type

(optionnal) character. Possible values are : "l" for line, "p" for points, "b" for both, "sl" for smoothed line, "st" for step

col

character, color of the new serie.

title

character, name of the new serie, used when legend is enabled.

fill_alphas

a numeric between 0 and 1 for printed area.

balloon

logical, add balloon with value or not

Examples

Run this code
if (requireNamespace("pipeR", quietly = TRUE)) {
require(pipeR)
amPlot(x = rnorm(100), type = 'sl') %>>%
  amLines(x = rnorm(100), type = "p")
}

if (FALSE) {
amPlot(x = rnorm(100), type = 'sl') %>>%
  amLines(x = rnorm(100), col = "blue") %>>%
  amLines(x = rnorm(100), type = "sl") %>>%
  amLines(x = rnorm(100), type = "p")

# For an XY chart
x <- sort(rnorm(100))
y1 <- rnorm(100, sd = 10)
y2 <- rnorm(100, sd = 10)
y3 <- rnorm(100, sd = 10)
amPlot(x = x, y = y1) %>>%
  amLines(x = y2, col = "blue") %>>%
  amLines(x = y3, type = "p")
}

Run the code above in your browser using DataLab