Creating a stacked barchart in R with ggplot2 (CC102)

  Рет қаралды 32,707

Riffomonas Project

Riffomonas Project

Күн бұрын

Пікірлер: 47
@Riffomonas
@Riffomonas 3 жыл бұрын
What is your favorite way to represent relative abundance data?
@aleonflux1138
@aleonflux1138 3 жыл бұрын
I tend to go with stacked barplots because it's what my supervisors expect - I show the most relevant dozen or so taxa with everything else grouped into 'Other'. I'd be keen to hear your thoughts on krona plots (they could be an improvement over stacked barplots if online journals could embed them with their interactivity intact).
@Riffomonas
@Riffomonas 3 жыл бұрын
Check out the next video where I’ll show how to make the stacked bar charts you’re describing
@lucyintheskyzzz1
@lucyintheskyzzz1 Жыл бұрын
@@Riffomonas When do you use relative abundance in metagenomics sequencing vs. blast x hit results? Which one is more accurate?
@lucyintheskyzzz1
@lucyintheskyzzz1 Жыл бұрын
@@Riffomonas Is there a color palette for 39 organisms?
@Riffomonas
@Riffomonas Жыл бұрын
@@lucyintheskyzzz1 hah - no. Really shouldn't be using more than 5-7 colors
@coralpardo8825
@coralpardo8825 3 жыл бұрын
Looking forward to learning other ways of presenting this type of data. Thank you for these videos, I have learned a lot!
@Riffomonas
@Riffomonas 3 жыл бұрын
My pleasure! Holler if you have any ideas you want me to demonstrate
@coralpardo8825
@coralpardo8825 3 жыл бұрын
@@Riffomonas heatmaps generated by ampvis2 give more information to the reader but maybe there is a better way? Looking forward to finding other options
@Riffomonas
@Riffomonas 3 жыл бұрын
@@coralpardo8825 We'll definitely get to heatmaps in the next few episodes to stay tuned! I'm not a huge fan, but they do have a place in your data viz toolkit
@williamvilchezcruz
@williamvilchezcruz 6 ай бұрын
Thank you so much, Dr. Schloss!
@TruongNguyen-nm2by
@TruongNguyen-nm2by 3 жыл бұрын
Thank you so much that I am trying to visualize. I learned a lot.
@Riffomonas
@Riffomonas 3 жыл бұрын
Wonderful! Glad you're finding the videos useful
@zainabalradi2306
@zainabalradi2306 Жыл бұрын
I love your channels. A questions to you and fellow fans, is there a tutorial that walks us throw basic vegan package functions in R to calculate basic relative abundance for each taxonomic levels to start with?
@faustovrz
@faustovrz 3 жыл бұрын
I order the groups by frequencies, so you kinda know if a group is more frequent in a bar or another. But yeah, I think this is the worst way to represent relative frequencies except for all the other ways that I know of.
@Riffomonas
@Riffomonas 3 жыл бұрын
Ah, don't be so pessimistic! Tomorrow's episode will demonstrate how to do what you're describing. Eventually, we'll get to strip charts and jitter plots for each OTU arrayed across the x-axis (or y-axis). That's my favorite approach
@alaakhalil7337
@alaakhalil7337 Жыл бұрын
Hi, thank you, professor. I have a problem I think I miss something. the y axis is scaled from 0-0.5 I have no clue how to fix it
@Riffomonas
@Riffomonas Жыл бұрын
Thanks for watching! You can use scale_y_continuous and set the limits=c(0,1) or you can also use the ylim function
@markhodson8385
@markhodson8385 2 жыл бұрын
Can you tell me what the name of the tutorial is that comes before this one that explains the setting up of the initial code that is shown in the first few minutes of the video. Or provide the link. Thanks Mark Hodson
@Riffomonas
@Riffomonas 2 жыл бұрын
Hi Mark - thanks for watching! The episodes are all numbered (this is CC102) to try to make it easier to find other episodes. CC101 is here: kzbin.info/www/bejne/m2TVfIyfpduXgNE. Also, you can find the full listing on the blog: riffomonas.org/code_club/
@kendallwojcik837
@kendallwojcik837 2 жыл бұрын
I am trying to create a stacked bar chart for soil carbon inventories with two stacked bars (organic and inorganic C) for each site. Any guidance there? I can get one stacked chart but can't seem to get the second one to show up
@Riffomonas
@Riffomonas 2 жыл бұрын
Hi Kendall - two ideas: are you using scale_x_discrete? Make sure you’re using the correct values for the breaks. Are you sure you have two x-axis values? Maybe double check by running count() on the column you’re mapping to x
@monzurmorshed.
@monzurmorshed. 2 жыл бұрын
Thank you professor for this video. I have one question. In this figure, there is a legend "Cyanobacteria/chloroplast". As far as I understand chloroplast and cyanobacteria are two different things in microbiome data. Could you tell me why it's written "Cyanobacteria/chloroplast"?
@Riffomonas
@Riffomonas 2 жыл бұрын
Thanks for watching Monzur! Chloroplasts are/were a type of Cyanobacteria to their taxonomy gets a little messy
@rishikeshdash12
@rishikeshdash12 2 жыл бұрын
i have two legends and i want to show them in the top right of the graph, but in legend.position only top, left, right and bottom is available
@Riffomonas
@Riffomonas 2 жыл бұрын
You can give legend.position=c(0.8, 0.7) where the 0.8 and 0.7 are hte relative positions on the plot
@rishikeshdash12
@rishikeshdash12 2 жыл бұрын
@@Riffomonas But sir I want To show Them Horizontally top of the Graph. Like It will show Above the 100 % relative Abundance
@Riffomonas
@Riffomonas 2 жыл бұрын
​@@rishikeshdash12 You should look at the different legend arguments for theme. I think you want the legend.position argument for the theme function. Also, if it wasn't clear from the video, I think stacked bar charts are pretty horrible 🤣
@rishikeshdash12
@rishikeshdash12 2 жыл бұрын
@@Riffomonas Sir, It's done I explored it. I got it what I want Using legend.position = "top", legend.justification = "right"
@rishikeshdash12
@rishikeshdash12 2 жыл бұрын
@@Riffomonas One more thing I want to say That... You are a great Human being 😇
@saubanmusazango2346
@saubanmusazango2346 2 жыл бұрын
Thank you for the wonderful tutorials, please i have an issue with joining columns at data entering stage I don’t know how you arranged the OTU table, metadata and taxa tables. Need your help
@Riffomonas
@Riffomonas 2 жыл бұрын
Hi Sauban - thanks for watching! I'd encourage you to check out the previous episode to this one that goes over where the data came from and how the joins and dplyr steps were carried out kzbin.info/www/bejne/m2TVfIyfpduXgNE
@saubanmusazango2346
@saubanmusazango2346 2 жыл бұрын
@@Riffomonas Thank you so much for your reply
@saubanmusazango2346
@saubanmusazango2346 2 жыл бұрын
@@Riffomonas I followed the video, it is interesting and understandable thank you Sir. my problem is my OTU table is totally different from the one you used. if i can get your email i will be glad to send you the table format. it is showing me that "join column must be present in data". thank you
@mgsports9561
@mgsports9561 9 ай бұрын
Hello, a question do you know how can fix this error in `geom_text()`: Can't find stat called "prop"?
@jamesstanley929
@jamesstanley929 2 жыл бұрын
Hi Pat. Great videos, helping massively with my PhD here in the UK. Is it possible to create two different stacked bar chart charts from the same ‘cleaned data’ (generated in CC101)? For example, in relation to your videos, I have two time points. So for your data I would have NonDC1, DC1, C1 (as in timepoint 1) as well as NonDC2, DC2, C2 (as in timepoint 2). I am interested in seeing only timepoint 1 variables in one chart, and timepoint 2 variables in another chart (ie 3 variables only on one chart, but I want to generate both using one string of commands). I have tried editing your code to do this but I’m a newbie so still learning. For now, I will create two ‘clean up data’ codes to account for both timepoint and create both sets of charts separately, but I’m sure what I have described can be done from one ‘clean up data’ (otu_rel_abund collation) Thanks in advance James
@Riffomonas
@Riffomonas 2 жыл бұрын
Thanks James! Just to be super clear I hate stacked barcharts 🤓. Regardless you could process all the data together and then use filters to make separate data frames with the data you want in each figure
@Rydaholic
@Rydaholic 2 жыл бұрын
Hi Pat, Great tutorial. Thank you for making it available! How did you group the OTUs that could not be assigned into phylum level into "Bacteria_unclassified"? I have OTUs that could not be assigned at phylum level and are therefore "blank" at phylum level. This appears in my figure with "blank" instead of "Bacteria_unclassified". Kind regards, Martin
@Riffomonas
@Riffomonas 2 жыл бұрын
Thanks! That is the classification that came from mothur
How to clean and join data from mothur with the dplyr R package (CC101)
25:48
WHO CAN RUN FASTER?
00:23
Zhong
Рет қаралды 44 МЛН
7 Days Stranded In A Cave
17:59
MrBeast
Рет қаралды 88 МЛН
👨‍🔧📐
00:43
Kan Andrey
Рет қаралды 11 МЛН
CHOCKY MILK.. 🤣 #shorts
00:20
Savage Vlogs
Рет қаралды 30 МЛН
🚨 YOU'RE VISUALIZING YOUR DATA WRONG. And Here's Why...
17:11
Adam Finer - Learn BI Online
Рет қаралды 80 М.
Bar Charts with {ggplot2}
13:38
yuzaR Data Science
Рет қаралды 5 М.
how to make soler led bulb | How do you use a soldering iron first time?
1:00
Nk creative experiment
Рет қаралды 3,6 МЛН
Как настроить камеру хоп-ап
1:00
TimToker
Рет қаралды 3 МЛН
ПОЧЕМУ МИКРОФОНЫ ИГРОВЫЕ? 🧐
0:46
KEKTAR
Рет қаралды 733 М.
На что способен ваш компьютер?
0:34
ноутбуки от 7.900 в тг laptopshoptop
0:14
Ноутбуковая лавка
Рет қаралды 4,1 МЛН