I have a plot I've dynamically created from a data.frame that looks like this:
slug provider n
id1 facebook 1
id2 twitter 1
id2 facebook 1
id3 email 1
... ... ...
Here is a gist with some toy data: https://gist.github.com/gaiusjaugustus/b8b0b61907fdb952ce481c2c7c05f76c
And created a plot with the following code.
ggplot(df, aes(x=slug, y=n, fill=provider)) + geom_bar(position="fill", stat="identity") + scale_y_continuous(labels=percent_format())
As you can see above, there are a lot of categories. What I'd like to do is somehow SORT the x-axis slugs
so that we can see trends. Here are a few examples:
See how this is organized so that you can really see trends well? Any help with getting this to work with ggplot2 would be great.