Creating a stacked barchart in R with ggplot2 (CC102)

Поділитися
Вставка
  • Опубліковано 5 вер 2024

КОМЕНТАРІ • 47

  • @Riffomonas
    @Riffomonas  3 роки тому +2

    What is your favorite way to represent relative abundance data?

    • @aleonflux1138
      @aleonflux1138 3 роки тому +2

      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 роки тому +1

      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 роки тому +2

    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 роки тому +1

      @@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 7 місяців тому

    Thank you so much, Dr. Schloss!

  • @TruongNguyen-nm2by
    @TruongNguyen-nm2by 3 роки тому +1

    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 роки тому +1

    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 роки тому +1

      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

  • @monzurmorshed.
    @monzurmorshed. 2 роки тому +1

    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

  • @markhodson8385
    @markhodson8385 2 роки тому +1

    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: ua-cam.com/video/e3rKYipvdJo/v-deo.html. Also, you can find the full listing on the blog: riffomonas.org/code_club/

  • @alaakhalil7337
    @alaakhalil7337 Рік тому +1

    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

  • @kendallwojcik837
    @kendallwojcik837 2 роки тому +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 роки тому +1

      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

  • @mgsports9561
    @mgsports9561 9 місяців тому

    Hello, a question do you know how can fix this error in `geom_text()`: Can't find stat called "prop"?

  • @saubanmusazango2346
    @saubanmusazango2346 2 роки тому +1

    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 ua-cam.com/video/e3rKYipvdJo/v-deo.html

    • @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

  • @rishikeshdash12
    @rishikeshdash12 2 роки тому +1

    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 роки тому +1

      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 роки тому +1

      ​@@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 😇

  • @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 роки тому +1

    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