library(tidyverse)
library(plotly)
library(trelliscopejs)
The trelliscopejs R package is an interface for creating Trelliscope displays with the goal of providing methods that are convenient to use in traditional visual / analytical workflows.
For example, the package provides methods that allow you to easily generate Trelliscope displays from ggplot2 or “tidy” workflows.
This data set contains a subset of the fuel economy data.It contains only models which had a new release every year between 1999 and 2008 .
head(mpg)
## # A tibble: 6 x 11
## manufacturer model displ year cyl trans drv cty hwy fl class
## <chr> <chr> <dbl> <int> <int> <chr> <chr> <int> <int> <chr> <chr>
## 1 audi a4 1.8 1999 4 auto(l5) f 18 29 p compa~
## 2 audi a4 1.8 1999 4 manual(m5) f 21 29 p compa~
## 3 audi a4 2 2008 4 manual(m6) f 20 31 p compa~
## 4 audi a4 2 2008 4 auto(av) f 21 30 p compa~
## 5 audi a4 2.8 1999 6 auto(l5) f 16 26 p compa~
## 6 audi a4 2.8 1999 6 manual(m5) f 18 26 p compa~
ggplot2:: ggplot(data = mpg)+aes(x=displ,y= hwy) +geom_point()
This is an interactive plot that does not run in an R Markdown environment.
ggplot(mpg,aes(displ,hwy))+
geom_point(size=4)+
geom_smooth(se=FALSE,span=1)+
facet_trelliscope(~manufacturer,ncol=4,nrow=3)