Skip to content

Commit f354819

Browse files
authored
Update README.md
Added section on reordering stacked bar plots
1 parent fc18434 commit f354819

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

README.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ It requires R, RStudio, and the rmarkdown package.
3232
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)
3333
10. [Friends Don't Let Friends Make Pie Charts](https://github.com/cxli233/FriendsDontLetFriends#10-friends-dont-let-friends-make-pie-chart)
3434
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]()
3637

3738
# 1. Friends Don't Let Friends Make Bar Plots for Means Separation
3839

@@ -228,6 +229,20 @@ Many scientific software still use red/green or rainbow as the default color sca
228229
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).
229230
And they look nice too.
230231

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+
![Reorder your stacked bars](https://github.com/cxli233/FriendsDontLetFriends/blob/main/Results/Reorder_stacked_bars.svg)
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+
231246
# Conclusion (?)
232247

233248
That's it for now. I will update this when I have the time (and inspirations) to produce more examples.

0 commit comments

Comments
 (0)