Setting global aesthetics: transparency

ggplot(___) + 
  geom_point(
    mapping = aes(x = ___, y = ___, 
                  color = ___, 
                  size  = ___),
    alpha  = ___
  )
View Interactive Version

Plotting many points with similar x- and y-coordinates in one graph can produce dense point clouds. Many points in these clouds are over plotted and the true number of observations in a certain area is not visible any more. As a solution, we can set the transparency of each point using the ggplot parameter alpha.

Since we do not want to set the point transparency individually for each point but globally for all points we do not set the alpha parameter as an aesthetic mapping (within aes()) but outside.

We set the opacity of each point to 50% through the parameter alpha outside as a constant parameter:

Input
ggplot(gapminder_2007) + 
  geom_point(aes(x = gdpPercap, y = lifeExp, size = pop), 
             alpha = 0.5)

We can now clearly see how many points are overlapping each other and the opacity of each point is set to 0.5.

Specify additional aesthetics for points