Skip to content

Instantly share code, notes, and snippets.

@timelyportfolio
Created November 21, 2016 19:08
Show Gist options
  • Save timelyportfolio/1a6edbe8fff6d246974c65e38a31303f to your computer and use it in GitHub Desktop.
Save timelyportfolio/1a6edbe8fff6d246974c65e38a31303f to your computer and use it in GitHub Desktop.
trelliscopejs and scatterD3

trelliscopejs examples with other widgets

Others in the series:

scatterD3

Here is some code for trelliscopejs combined with scatterD3.

library(trelliscopejs)
library(dplyr)
library(tidyr)
library(scatterD3)
library(ggplot2)

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")
    )
  ) %>%
  trelliscope(name = "city_vs_highway_mpg", nrow = 2, ncol = 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment