Learn R Programming

daltoolbox (version 1.2.747)

plot_series: Plot series

Description

Line plot for one or more series over a common x index.

Usage

plot_series(data, label_x = "", label_y = "", colors = NULL)

Value

returns a ggplot2::ggplot graphic

Arguments

data

data.frame with x in the first column and series in remaining columns

label_x

x‑axis label

label_y

y‑axis label

colors

optional vector of colors for series

Details

Expects a data.frame where the first column is the x index and remaining columns are numeric series. Points and lines are drawn per series; supply colors to override the palette.

Examples

Run this code
x <- seq(0, 10, 0.25)
data <- data.frame(x, sin=sin(x))
head(data)

grf <- plot_series(data, colors=c("red"))
plot(grf)

Run the code above in your browser using DataLab