Faceting med TrelliscopeJS

Visualisering av big data med Trelliscope i R

Ryan Hafen

Author, TrelliscopeJS

Faceting med TrelliscopeJS

Visualisering av big data med Trelliscope i R

Gapminder-data

library(gapminder)
head(gapminder)
# A tibble: 6 x 6
  country     continent  year lifeExp      pop gdpPercap
  <fct>       <fct>     <int>   <dbl>    <int>     <dbl>
1 Afghanistan Asia       1952    28.8  8425333       779
2 Afghanistan Asia       1957    30.3  9240934       821
3 Afghanistan Asia       1962    32.0 10267083       853
4 Afghanistan Asia       1967    34.0 11537966       836
5 Afghanistan Asia       1972    36.1 13079460       740
6 Afghanistan Asia       1977    38.4 14880372       786
Visualisering av big data med Trelliscope i R

Medellivslängd över tid per land

ggplot(gapminder, aes(year, lifeExp, group = country)) +
  geom_line()

Visualisering av big data med Trelliscope i R

Faceting per kontinent

ggplot(gapminder, aes(year, lifeExp, group = country, color = continent)) +
  geom_line() +
  facet_wrap(~ continent, nrow = 1) +
  guides(color = FALSE)

Visualisering av big data med Trelliscope i R

Faceting per land

ggplot(gapminder, aes(year, lifeExp)) +
  geom_line() +
  facet_wrap(~ country + continent)

Visualisering av big data med Trelliscope i R

Faceting med TrelliscopeJS

Det räcker med att byta ut facet_wrap() mot facet_trelliscope().

Precis som med facet_wrap() styr du rader och kolumner med nrow och ncol.

Ytterligare alternativ:

  • Ange rutnätslayouten med nrow och ncol, på samma sätt som i facet_wrap().
  • Ge visningen ett namn (name) och en beskrivning (desc).
  • Ange var visningen ska sparas med path.
Visualisering av big data med Trelliscope i R

Nu kör vi en övning!

Visualisering av big data med Trelliscope i R

Preparing Video For Download...