Zichtbare esthetieken

Introductie tot datavisualisatie met ggplot2

Rick Scavetta

Founder, Scavetta Academy

Mappen op de X- en Y-as

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width)) + 
  geom_point()

Introductie tot datavisualisatie met ggplot2

Mappen op kleur

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) + 
  geom_point()
Type Variabele
Kleur Species

Introductie tot datavisualisatie met ggplot2

Mappen op de kleur-esthetiek

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) + 
  geom_point()
Type Variabele
Kleur Species

Species, een kolom in de dataframe, wordt gemapt op kleur, een zichtbare esthetiek.

Introductie tot datavisualisatie met ggplot2

Mappen op de kleur-esthetiek

ggplot(iris, aes(x = Sepal.Length, 
                 y = Sepal.Width, 
                 color = Species)) + 
  geom_point()
Type Variabele
Kleur Species

Species, een kolom in de dataframe, wordt gemapt op kleur, een zichtbare esthetiek.

Map esthetieken in aes().

Introductie tot datavisualisatie met ggplot2

Mappen op de kleur-esthetiek in geom

ggplot(iris) + 
  geom_point(aes(x = Sepal.Length,
                 y = Sepal.Width,
                 col = Species))

Alleen nodig als:

  • Niet alle lagen dezelfde esthetieken moeten erven
  • Je verschillende databronnen mixt

Introductie tot datavisualisatie met ggplot2

Typische zichtbare esthetieken

Esthetiek Omschrijving
x Positie X-as
y Positie Y-as
Introductie tot datavisualisatie met ggplot2

Typische zichtbare esthetieken

Esthetiek Omschrijving
x Positie X-as
y Positie Y-as
fill Vulkleur
Introductie tot datavisualisatie met ggplot2

Typische zichtbare esthetieken

Esthetiek Omschrijving
x Positie X-as
y Positie Y-as
fill Vulkleur
color Kleur van punten, omlijnen van andere geoms
Introductie tot datavisualisatie met ggplot2

Typische zichtbare esthetieken

Esthetiek Omschrijving
x Positie X-as
y Positie Y-as
fill Vulkleur
color Kleur van punten, omlijnen van andere geoms
size Oppervlak of straal van punten, lijndikte
Introductie tot datavisualisatie met ggplot2

Typische zichtbare esthetieken

Esthetiek Omschrijving
x Positie X-as
y Positie Y-as
fill Vulkleur
color Kleur van punten, omlijnen van andere geoms
size Oppervlak of straal van punten, lijndikte
Esthetiek Omschrijving
alpha Transparantie
Introductie tot datavisualisatie met ggplot2

Typische zichtbare esthetieken

Esthetiek Omschrijving
x Positie X-as
y Positie Y-as
fill Vulkleur
color Kleur van punten, omlijnen van andere geoms
size Oppervlak of straal van punten, lijndikte
Esthetiek Omschrijving
alpha Transparantie
linetype Streepjespatroon van lijn
Introductie tot datavisualisatie met ggplot2

Typische zichtbare esthetieken

Esthetiek Omschrijving
x Positie X-as
y Positie Y-as
fill Vulkleur
color Kleur van punten, omlijnen van andere geoms
size Oppervlak of straal van punten, lijndikte
Esthetiek Omschrijving
alpha Transparantie
linetype Streepjespatroon van lijn
labels Tekst in plot of op assen
Introductie tot datavisualisatie met ggplot2

Typische zichtbare esthetieken

Esthetiek Omschrijving
x Positie X-as
y Positie Y-as
fill Vulkleur
color Kleur van punten, omlijnen van andere geoms
size Oppervlak of straal van punten, lijndikte
Esthetiek Omschrijving
alpha Transparantie
linetype streepjespatroon van lijn
labels Tekst in plot of op assen
shape Vorm
Introductie tot datavisualisatie met ggplot2

Laten we oefenen!

Introductie tot datavisualisatie met ggplot2

Preparing Video For Download...