IniziaInizia gratis

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.

Questo esercizio fa parte del corso

Introduction to Data Visualization with ggplot2

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Plot education, filled by vocabulary
___
Modifica ed esegui il codice