Improving the appearance of a stacked barchart with ggplot2, dplyr, and forcats (CC103)

preview_player
Показать описание
Sometimes we don't have a choice in the type of data visualization format we use. Although a stacked barchart is not ideal, there are methods for improving the appearance of stacked barcharts. In this episode of Code Club, Pat uses ggplot2, dplyr, and forcats to show how to pool rare taxa and order the more abundant taxa to give a common anchor point on the y-axis to make comparisons.

Do you have a figure that you would like to receive a critique or help improving? Let me know and I'd be happy to arrange a guest appearance!

You can also find complete tutorials for learning R with the tidyverse using...

0:00 Introduction
4:16 Pooling rare phyla
8:36 Specifying order of stacked bars w/ help of forcats
14:41 Changing colors and appearance of legend
17:33 Making bars sit on x-axis
18:15 Critique of figure
21:28 Recap
Рекомендации по теме
Комментарии
Автор

Without using a different chart type, what else would you do to improve the appearance of these stacked bar charts?

Riffomonas
Автор

Love stacked bar charts! What alternative do you prefer?

mikodine
Автор

Interesting, I'm back to R and study how write code, this video is useful for start to make charts with weather information, thanks for your video was very helpful.

david
Автор

amazing videos! glad I found your stuff! greetings from germany :)

svenr
Автор

Thanks for sharing these.very helpful!!

liliabkar
Автор

Well, the.beauty of you presentations is that you not only learn R.... Actually, what I learn is English😃😃😃

julianrozenberg
Автор

Thanks a lot! Is there a way (not manually) to reorder the stacked bar plots in a specific/ascending order of the most abundant taxa (Firmicutes)? Leaving Healthy on the left, changing the position of Diarrhea pos. to middel and Diarrhea neg. to the right?

thorbjornf.
Автор

Thank you for the video. What will we do if we want to sort bar in order. For example, we want to put Fermicute at the bottom and the mean will increase in the order : Healthy, Diarrhea C difficile positive, and Diarrhea C difficile negative ?

minhtrungdang
Автор

Thank you so much for your lectures. They really help me understand the basics of R.

I have a questions concerning barcharts in ggplot2. Is there a way to place the bars and tick labels between the tick marks rather than on them? This is possible in excel. It will be nice to replicate that in R

ndipagbor
Автор

Would it be better to separate the phyla into their own graphs and look at them separately? Like different facets or grids? One for each Phyla?

JacobHackman-qd
Автор

Great videos! You can simplify the pooling of taxa with forcats::fct_lump functions into one step, which I find really handy.

christophschweingruber
Автор

how we calculate percentage of each sample.. can you tell me..?

muhammadrahmanalishah