Aan de slagGa gratis aan de slag

Bar plots: sequential color palette

In this bar plot, we'll fill each segment according to an ordinal variable. The best way to do that is with a sequential color palette.

Here's an example of using a sequential color palette with the mtcars dataset:

ggplot(mtcars, aes(fcyl, fill = fam)) +
  geom_bar() +
  scale_fill_brewer(palette = "Set1")

In the exercise, you'll use similar code on the the Vocab dataset. Both datasets are ordinal.

Deze oefening maakt deel uit van de cursus

Introduction to Data Visualization with ggplot2

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Plot education, filled by vocabulary
___
Code bewerken en uitvoeren