Learn R Programming

tidycharts (version 0.1.3)

line_chart_dense: Line chart with more points then categories on x-axis.

Description

Line chart with more points then categories on x-axis.

Usage

line_chart_dense(data, dates, series, interval = "months")

Arguments

data

Data frame in wide format.

dates

Name of column in `data` which contains dates or vector of dates.

series

Vector of column names in `data` with values of time series.

interval

Granularity of x axis. One of c('weeks', 'months', 'quarters', 'years'). Default value is 'months'.

Value

object of class tidychart with a character vector containing SVG elements

Examples

Run this code
# NOT RUN {
df <- data.frame(
 x = seq.Date(as.Date('2021-01-01'), as.Date('2021-07-01'), length.out = 200),
 'Company_sin' = 5 * sin(seq(
   from = 0,
   to = 2 * pi,
   length.out = 200
   )) +  rnorm(200, mean = 5, sd = 0.5),
 'Company_cos' = 5 * cos(seq(
   from = 0,
   to = 2 * pi,
   length.out = 200
 )) +  rnorm(200, mean = 5, sd = 0.5))

df <- head(df, n = 199)

line_chart_dense(
  df,
  dates = 'x',
  series = c('Company_sin', 'Company_cos'))

# }

Run the code above in your browser using DataLab