Reordering graphs
The graph you built in the last exercise was readable, but it would be easier to understand it at a glance if it was ordered. Let's use some forcats
functions to change the graph so it's ordered in descending order of average usefulness from left to right.
The dataset usefulness_by_platform
has been loaded for you.
Diese Übung ist Teil des Kurses
Categorical Data in the Tidyverse
Anleitung zur Übung
- Order
learning_platform
in the graph byavg_usefulness
so that, from left to right, it goes from highest usefulness to lowest.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
usefulness_by_platform %>%
# Reorder learning_platform by avg_usefulness
mutate(learning_platform = ___(___, ___)) %>%
# Reverse the order of learning_platform
mutate(learning_platform = ___) %>%
ggplot(aes(x = learning_platform, y = avg_usefulness)) +
geom_point() +
theme(axis.text.x = element_text(angle = 90, hjust = 1)) +
labs(x = "Learning Platform", y = "Percent finding at least somewhat useful") +
scale_y_continuous(labels = scales::percent_format())