Reputation: 31
I provided an image of the code I already have, but how do I make it in descending order?
Upvotes: 1
Views: 584
Reputation: 1922
df <- data.frame(
stringsAsFactors = FALSE,
type = c('Ave', 'Blvd', 'Cirle', 'Court', 'Dr'),
total = c(254, 25, 30, 35, 550)
)
ggplot(data = df,
mapping = aes(x = fct_reorder(type, total), y = total)) +
geom_bar(stat = 'identity', fill = '#112446')+
theme_bw()
add .desc = TRUE to fct_reorder for descending
ggplot(data = df,
mapping = aes(x = fct_reorder(type, total, .desc = TRUE), y = total)) +
geom_bar(stat = 'identity', fill = '#112446')+
theme_bw()
Upvotes: 5