Faceting s TrelliscopeJS

Vizualizace velkých dat s Trelliscope v R

Ryan Hafen

Author, TrelliscopeJS

Faceting s TrelliscopeJS

Vizualizace velkých dat s Trelliscope v R

Data Gapminder

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
Vizualizace velkých dat s Trelliscope v R

Střední délka života v čase podle země

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

Vizualizace velkých dat s Trelliscope v R

Faceting podle kontinentu

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

Vizualizace velkých dat s Trelliscope v R

Faceting podle země

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

Vizualizace velkých dat s Trelliscope v R

Faceting s TrelliscopeJS

Stačí nahradit facet_wrap() za facet_trelliscope().

Stejně jako u facet_wrap() lze ovládat řádky a sloupce pomocí nrow a ncol.

Další možnosti:

  • Rozložení mřížky pomocí nrow a ncol, podobně jako u facet_wrap().
  • Pojmenování zobrazení (name) a popis (desc).
  • Umístění zobrazení pomocí path.
Vizualizace velkých dat s Trelliscope v R

Pojďme procvičovat!

Vizualizace velkých dat s Trelliscope v R

Preparing Video For Download...