You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-1
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,8 @@ It requires R, RStudio, and the rmarkdown package.
32
32
9.[Friends Don't Let Friends Confuse Position and Length Based Visualizations](https://github.com/cxli233/FriendsDontLetFriends#9-friends-dont-let-friends-confuse-position-based-visualizations-with-length-based-visualizations)
33
33
10.[Friends Don't Let Friends Make Pie Charts](https://github.com/cxli233/FriendsDontLetFriends#10-friends-dont-let-friends-make-pie-chart)
34
34
11.[Friends Don't Let Friends Make Concentric Donuts](https://github.com/cxli233/FriendsDontLetFriends#11-friends-dont-let-friends-make-concentric-donuts)
35
-
12.[Friends Don't Let Friends Use Red/green and Rainbow for Color Scales](https://github.com/cxli233/FriendsDontLetFriends#12-friends-dont-let-friends-use-redgreen-and-rainbow-color-scales)
35
+
12.[Friends Don't Let Friends Use Red/green and Rainbow for Color Scales](https://github.com/cxli233/FriendsDontLetFriends#12-friends-dont-let-friends-use-redgreen-and-rainbow-color-scales)
36
+
13.[Friends Don't Let Friends Forget to Reorder Stacked Bar Plot]()
36
37
37
38
# 1. Friends Don't Let Friends Make Bar Plots for Means Separation
38
39
@@ -228,6 +229,20 @@ Many scientific software still use red/green or rainbow as the default color sca
228
229
More "modern" color scales, such as [viridis](https://cran.r-project.org/web/packages/viridis/vignettes/intro-to-viridis.html) are both colorblind-friendly and grey scale-safe (third row of figure).
229
230
And they look nice too.
230
231
232
+
# 13. Friends Don't Let Friends Forget to Reorder Stacked Bar Plot
233
+
Stacked bar plots are useful for visualizing proportion data.
234
+
Stacked bar plots are commonly used to visualize community structure or population structure or admixture analysis.
235
+
This kind of visualization boils down to a collection of samples, where each sample contains multiple classes of members.
236
+
However, when we have many samples and many classes, stacked bar plots need to be optimized to be effective.
237
+
And by "optimize" I mean the grouping and ordering of samples.
238
+
239
+

240
+
241
+
Here we have an example data with 100 samples and 8 classes of member.
242
+
Due to the number of samples and classes, it is very hard to discern anything from this graph without optimizing the order of bars. What the heck am I looking at?
243
+
After reordering the the bars, __wow__, that really made a difference, don't you think?
244
+
For a tutorial on how to optimize a stack bar plot, see [this script](https://github.com/cxli233/FriendsDontLetFriends/blob/main/Scripts/stacked_bars_optimization.Rmd).
245
+
231
246
# Conclusion (?)
232
247
233
248
That's it for now. I will update this when I have the time (and inspirations) to produce more examples.
0 commit comments