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

histogram

Histogram & Density


Description

Add a histogram or density plots.

Usage

e_histogram(
  e,
  serie,
  breaks = "Sturges",
  name = NULL,
  legend = TRUE,
  bar_width = "99%",
  x_index = 0,
  y_index = 0,
  ...
)

e_density(
  e,
  serie,
  breaks = "Sturges",
  name = NULL,
  legend = TRUE,
  x_index = 0,
  y_index = 0,
  smooth = TRUE,
  ...
)

e_histogram_(
  e,
  serie,
  breaks = "Sturges",
  name = NULL,
  legend = TRUE,
  bar_width = "90%",
  x_index = 0,
  y_index = 0,
  ...
)

e_density_(
  e,
  serie,
  breaks = "Sturges",
  name = NULL,
  legend = TRUE,
  x_index = 0,
  y_index = 0,
  smooth = TRUE,
  ...
)

Arguments

e

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

serie

Column name of serie to plot.

breaks

Passed to hist.

name

name of the serie.

legend

Whether to add serie to legend.

bar_width

Width of bars.

x_index

Indexes of x and y axis.

y_index

Indexes of x and y axis.

...

Any other option to pass, check See Also section.

smooth

Whether to use smoothed lines, passed to e_line.

See Also

Examples

mtcars %>%
  e_charts() %>%
  e_histogram(mpg, name = "histogram") %>%
  e_density(mpg, areaStyle = list(opacity = .4), smooth = TRUE, name = "density", y_index = 1) %>%
  e_tooltip(trigger = "axis")

# timeline
mtcars %>%
  group_by(cyl) %>%
  e_charts(timeline = TRUE) %>%
  e_histogram(mpg, name = "histogram") %>%
  e_density(mpg, name = "density", y_index = 1)

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.