Powerful interactive visualisations in R.

Get Started Themes Timeline Shiny Demo

Installation

The package is available on CRAN. The full installation can be obtained with:

install.packages("echarts4r")

However, if you only want a lite version you can simply do, this is useful for a lighter version that installs faster if you do not want to use any of the geospatial features of the package:

install.packages("echarts4r", dependencies = c("Depends", "Imports"))

You can also install the unstable development version of echarts4r with remotes from Github, see changes.

# install.packages("remotes")
remotes::install_github("JohnCoene/echarts4r") # github

Companions

Companion packages to make echarts4r even better. You can install and load the whole suite with:

remotes::install_github("JohnCoene/echarts4r.suite")

echarts4r.assets

Icons, and assets for globes, add visually interesting globe overlays and background.

remotes::install_github('JohnCoene/echarts4r.assets')

Website Github

echarts4r.maps

A collection of 215 country maps to use with geo-spatial visualisations.

remotes::install_github('JohnCoene/echarts4r.maps')

Website Github

Example

Create multiple charts, arrange them in a grid and connect their interactions; this is nonsensical chart for demonstration purposes.

library(dplyr)
library(echarts4r)
library(echarts4r.assets)

e1 <- iris %>% 
  group_by(Species) %>% 
  e_charts(
    Sepal.Length,
    elementId = "chart"
  ) %>% 
  e_scatter(Petal.Length, Sepal.Width) %>% 
  e_datazoom(show = FALSE, y_index = 0) %>% 
  e_x_axis(min = 4) %>%  
  e_highlight(
    series_name = list("setosa", "versicolor", "virginica"), 
    btn = "high"
  ) %>% 
  e_downplay(
    series_name = list("setosa", "versicolor", "virginica"), 
    btn = "down"
  ) %>% 
  e_button(
    "high", "Highlight", 
    class = "btn btn-primary", 
    position = "bottom"
  ) %>% 
  e_button(
    "down", "Downplay", 
    class = "btn btn-default", 
    position = "bottom"
  ) %>% 
  e_legend(FALSE) %>% 
  e_title("Connect charts") %>% 
  e_tooltip(
    trigger = "item",
    axisPointer = list(
      type = "cross"
    )
  ) %>% 
  e_image_g(
    left = 50,
    top = 30,
    z = 999,
    style = list(
      image = "reference/figures/logo.png",
      width = 70,
      height = 75,
      opacity = .95
    )
  ) %>% 
  e_text_style(fontFamily = "Raleway")

e2 <- iris %>% 
  group_by(Species) %>%
  e_charts(Petal.Length) %>% 
  e_line(Sepal.Length) %>% 
  e_connect("chart") %>% 
  e_datazoom(y_index = 0) %>% 
  e_x_axis(min = 0) %>% 
  e_legend(
    bottom = 5,
    icons = ea_icons(
      c("warning", "signal", "photo")
    )
  ) %>% 
  e_tooltip(
    trigger = "item",
    axisPointer = list(
      type = "cross"
    )
  ) %>% 
  e_text_style(fontFamily = "Raleway")

e_arrange(e1, e2, rows = 1, cols = 2)