Visible aesthetics

Introduzione alla visualizzazione dei dati con ggplot2

Rick Scavetta

Founder, Scavetta Academy

Mapping onto the X and Y axes

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

Introduzione alla visualizzazione dei dati con ggplot2

Mapping onto color

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

Introduzione alla visualizzazione dei dati con ggplot2

Mapping onto the color aesthetic

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

Species, a dataframe column, is mapped onto color, a visible aesthetic.

Introduzione alla visualizzazione dei dati con ggplot2

Mapping onto the color aesthetic

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

Species, a dataframe column, is mapped onto color, a visible aesthetic.

Map aesthetics in aes().

Introduzione alla visualizzazione dei dati con ggplot2

Mapping onto the color aesthetic in geom

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

Only necessary if:

  • All layers should not inherit the same aesthetics
  • Mixing different data sources

Introduzione alla visualizzazione dei dati con ggplot2

Typical visible aesthetics

Aesthetic Description
x X axis position
y Y axis position
Introduzione alla visualizzazione dei dati con ggplot2

Typical visible aesthetics

Aesthetic Description
x X axis position
y Y axis position
fill Fill color
Introduzione alla visualizzazione dei dati con ggplot2

Typical visible aesthetics

Aesthetic Description
x X axis position
y Y axis position
fill Fill color
color Color of points, outlines of other geoms
Introduzione alla visualizzazione dei dati con ggplot2

Typical visible aesthetics

Aesthetic Description
x X axis position
y Y axis position
fill Fill color
color Color of points, outlines of other geoms
size Area or radius of points, thickness of lines
Introduzione alla visualizzazione dei dati con ggplot2

Typical visible aesthetics

Aesthetic Description
x X axis position
y Y axis position
fill Fill color
color Color of points, outlines of other geoms
size Area or radius of points, thickness of lines
Aesthetic Description
alpha Transparency
Introduzione alla visualizzazione dei dati con ggplot2

Typical visible aesthetics

Aesthetic Description
x X axis position
y Y axis position
fill Fill color
color Color of points, outlines of other geoms
size Area or radius of points, thickness of lines
Aesthetic Description
alpha Transparency
linetype Line dash pattern
Introduzione alla visualizzazione dei dati con ggplot2

Typical visible aesthetics

Aesthetic Description
x X axis position
y Y axis position
fill Fill color
color Color of points, outlines of other geoms
size Area or radius of points, thickness of lines
Aesthetic Description
alpha Transparency
linetype Line dash pattern
labels Text on a plot or axes
Introduzione alla visualizzazione dei dati con ggplot2

Typical visible aesthetics

Aesthetic Description
x X axis position
y Y axis position
fill Fill color
color Color of points, outlines of other geoms
size Area or radius of points, thickness of lines
Aesthetic Description
alpha Transparency
linetype line dash pattern
labels Text on a plot or axes
shape Shape
Introduzione alla visualizzazione dei dati con ggplot2

Let's Practice

Introduzione alla visualizzazione dei dati con ggplot2

Preparing Video For Download...