Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

errorbar

Error bar


Description

Add error bars.

Usage

e_error_bar(
  e,
  lower,
  upper,
  name = NULL,
  legend = FALSE,
  y_index = 0,
  x_index = 0,
  coord_system = "cartesian2d",
  ...
)

e_error_bar_(
  e,
  lower,
  upper,
  name = NULL,
  legend = FALSE,
  y_index = 0,
  x_index = 0,
  coord_system = "cartesian2d",
  itemStyle = list(borderWidth = 1.5),
  renderer = "renderErrorBar2",
  ...
)

Arguments

e

An echarts4r object as returned by e_charts or a proxy as returned by echarts4rProxy.

lower, upper

Lower and upper error bands.

name

name of the serie.

legend

Whether to add serie to legend.

y_index

Indexes of x and y axis.

x_index

Indexes of x and y axis.

coord_system

Coordinate system to plot against.

...

Any other option to pass, check See Also section.

itemStyle

mostly used for borderWidth, default 1.5

renderer

mame of render function from renderers.js

Examples

df <- data.frame(
  x = factor(c(1, 2)),
  y = c(1, 5),
  upper = c(1.1, 5.3),
  lower = c(0.8, 4.6)
)

df %>%
  e_charts(x) %>%
  e_bar(y) %>%
  e_error_bar(lower, upper)

# timeline
df <- data.frame(
  x = factor(c(1, 1, 2, 2)),
  y = c(1, 5, 3, 4),
  step = factor(c(1, 2, 1, 2)),
  upper = c(1.1, 5.3, 3.3, 4.2),
  lower = c(0.8, 4.6, 2.4, 3.6)
)

df %>%
  group_by(step) %>%
  e_charts(x, timeline = TRUE) %>%
  e_bar(y) %>%
  e_error_bar(lower, upper)

echarts4r

Create Interactive Graphs with 'Echarts JavaScript' Version 5

v0.4.0
Apache License (>= 2.0)
Authors
John Coene [aut, cre, cph], Wei Su [ctb], Helgasoft [ctb], Xianying Tan [ctb] (<https://orcid.org/0000-0002-6072-3521>)
Initial release
2021-03-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.