Others in the series:
Here is some code for trelliscopejs
combined with scatterD3
.
library(trelliscopejs)
library(dplyr)
library(tidyr)
library(scatterD3)
library(ggplot2)
xlims <- range(mpg$cty)
ylims <- range(mpg$hwy)
mpg %>%
group_by(manufacturer, class) %>%
summarise(
mean_city_mpg = cog(mean(cty), desc = "Mean city mpg"),
mean_hwy_mpg = cog(mean(hwy), desc = "Mean highway mpg"),
panel = panel(
scatterD3(x=c(cty), y=c(hwy), xlab="City mpg", ylab="Highway mpg",
xlim=xlims, ylim=ylims)
)
) %>%
trelliscope(name = "city_vs_highway_mpg", nrow = 2, ncol = 2)