Everybody loves colors but only few know how to use them well. With the right guidelines, using colors becomes super easy. Let me show you how to implement these guidelines with ggplot π§΅ #rstats
4
44
168
Replies
Anyone can create a stacked bar chart with ggplot. But that can end up in a colorful & messy plot. Let's implement a couple of guidelines from this datawrapper blog post to level up our color game https://t.co/oxH1EXBATU
1
1
15
Once you have fewer colors. You can concentrate on a better choice. How about the color-blind safe okabe ito palette? While you're at it. How about a better range of `alpha` values so that top and bottom blocks have the same transparency?
1
0
7
Now comes the hard part. Consolidate the two legends into one. Overwriting the aesthetics in a guides() layer will do the trick.
1
1
10
There you go. Same information as in the beginning but less of a rainbow mess. π Still it would be nice to make adjacent blocks stand out. No problem. Use the `color` aesthetic to add lines. But wait. There is more π₯³
2
1
7
Spaghetti plots are easy to create but hard to decipher. This is a chance to shine for the {gghighlight} package.
1
2
9
{gghighlight} makes it dead-simple to emphasize parts of your plot. And with a small annotation, we can immediately tell a story.
1
1
14
Of course, this also works with more than just one color. Once we get rid of too many colors, why not also get rid of other clutter like the legend?
1
1
7
That's some efficient use of space and colors right there! Finally, let's come full circle and apply the same labeling techniques to our initial bar plot.
1
0
7
That's a wrap π₯³ For the full code and more explanations, check out my blog post at https://t.co/CcCJwHH0MV Let me know if you enjoyed this thread, by hitting the like button on the start of this thread below. βΊοΈ For more posts like this, follow @rappa753 See you next time π
Everybody loves colors but only few know how to use them well. With the right guidelines, using colors becomes super easy. Let me show you how to implement these guidelines with ggplot π§΅ #rstats
2
3
12
If you liked this post, you may enjoy my 3-minute newsletter too. Every week, my newsletter shares insights on - R & dataviz, - Shiny and web dev Reading time: 3 minutes or less You can join at https://t.co/GePE370FdL
0
0
1