Trelliscope is a scalable, flexible, interactive approach to visualizing data. The trelliscopejs R package provides methods that make it easy to create a Trelliscope display specification for the Trelliscope JavaScript library trelliscopejs-lib. High-level functions are provided for creating displays from within dplyr (via summarise()
) or ggplot2 (via facet_trelliscope()
) workflows. Low-level functions are also provided for creating new interfaces.
Note that this package, trelliscopejs is the successor of the [trelliscope] package which is available on CRAN and is part of the DeltaRho project. Eventually the trelliscopejs package will replace trelliscope and plug in to the DeltaRho ecosystem as well.
devtools::install_github("hafen/trelliscopejs")
The examples below are minimal. Please see the package vignettes for more.
library(trelliscopejs)
library(ggplot2)
library(gapminder)
qplot(year, lifeExp, data = gapminder) +
xlim(1948, 2011) + ylim(10, 95) + theme_bw() +
facet_trelliscope(~ country + continent, nrow = 2, ncol = 7, width = 300)
library(trelliscopejs)
library(tidyverse)
library(rbokeh)
library(gapminder)
# nest gapminder data by country
by_country <- gapminder %>%
group_by(country, continent) %>%
nest()
# add in a plot column with map_plot
by_country <- by_country %>% mutate(
panel = map_plot(data,
~ figure(xlim = c(1948, 2011), ylim = c(10, 95), width = 300, tools = NULL) %>%
ly_points(year, lifeExp, data = .x, hover = .x)
))
# plot it
by_country %>%
trelliscope("gapminder", nrow = 2, ncol = 7)