I was trying to plot tweets' sources/devices in a decreasing order using ggplot/geom_segment in R. Here is the code I ran:
ggplot(data = device, mapping = aes(x = fct_reorder(as.factor(source), n), y = n)) +
geom_segment(aes(x = source, xend = source, y = 0, yend = n)) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, family = "sans")) +
labs(title = "Tweets by device/source", x = "device/source", y = "frequency") +
geom_point(size = 4, color = "red", fill = alpha("yellow", 0.3), alpha = 0.7, shape = 21, stroke = 2)
Here is the plot it returned, which is not in decreasing pattern as I wanted to be.
So, I was wondering how could I plot the geom_segment in decreasing order?