Learn R Programming

echarts4r (version 0.1.1)

e_heatmap: Heatmap

Description

Draw heatmap by coordinates.

Usage

e_heatmap(e, y, z, name = NULL, coord.system = "cartesian2d",
  rm.x = TRUE, rm.y = TRUE, ...)

e_heatmap_(e, y, z = NULL, name = NULL, coord.system = "cartesian2d", rm.x = TRUE, rm.y = TRUE, ...)

Arguments

e

An echarts4r object as returned by e_charts.

y, z

Coordinates and values.

name

name of the serie.

coord.system

Coordinate system to plot against, takes cartesian2d, geo or calendar.

rm.x, rm.y

Whether to remove x and y axis, only applies if coord.system is not set to cartesian2d.

...

Any other option to pass, check See Also section.

See Also

https://ecomfe.github.io/echarts-doc/public/en/option.html#series-heatmap

Examples

Run this code
# NOT RUN {
v <- LETTERS[1:10]
matrix <- data.frame(
  x = sample(v, 300, replace = TRUE), 
  y = sample(v, 300, replace = TRUE), 
  z = rnorm(300, 10, 1),
  stringsAsFactors = FALSE
) %>% 
  dplyr::group_by(x, y) %>% 
  dplyr::summarise(z = sum(z)) %>% 
  dplyr::ungroup()

matrix %>% 
  e_charts(x) %>% 
  e_heatmap(y, z) %>% 
  e_visual_map(z)

# calendar   
dates <- seq.Date(as.Date("2018-01-01"), as.Date("2018-12-31"), by = "day")
values <- rnorm(length(dates), 20, 6)

year <- data.frame(date = dates, values = values)

year %>% 
  e_charts(date) %>% 
  e_calendar(range = "2018") %>% 
  e_heatmap(values, coord.system = "calendar") %>% 
  e_visual_map(max = 30)

# }

Run the code above in your browser using DataLab