Creating a pie chart in R with ggplot2 using microbiome data ... and why you shouldn't (CC104)

Поделиться
HTML-код
  • Опубликовано: 6 июл 2024
  • Pie charts are very popular data visualization tools with the lay public and scientists for representing fractions of a whole. In this Code Club, Pat will show how to create a pie chart in R using ggplot2. He'll also point out why a pie chart is rarely (ever?) the appropriate tool for the job. Regardless, if you're forced to use a pie chart, he'll show how you can use the ggplot R package to make the most of the medium.
    Pat will use RStudio and the #coord_polar and #facet_wrap from the #ggplot2 package. The accompanying blog post can be found at www.riffomonas.org/code_club/....
    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!
    If you're interested in taking an upcoming 3 day R workshop, email me at riffomonas@gmail.com!
    R: r-project.org
    RStudio: rstudio.com
    Raw data: github.com/riffomonas/raw_dat...
    Workshops: www.mothur.org/wiki/workshops
    You can also find complete tutorials for learning R with the tidyverse using...
    Microbial ecology data: www.riffomonas.org/minimalR/
    General data: www.riffomonas.org/generalR/
    0:00 Introduction
    4:33 Critique of pie charts
    9:15 Recreating stacked barcharts
    10:22 Creating concentric pie charts / donut plots
    17:19 Creating faceted pie charts
    24:13 Recap
  • НаукаНаука

Комментарии • 13

  • @danielvaulot5105
    @danielvaulot5105 3 года назад

    Hi Pat, this was good full of little neat tricks to adjust the labels etc... Any chance you will talk about treemaps (basically square pie charts) ?

    • @Riffomonas
      @Riffomonas  3 года назад

      Hi Daniel! Thanks for the idea - I like the idea of looking at different approaches for describing hierarchy in data. I'm going to spend some time talking about how to represent relative abundances, but I'll be sure to come back to how we can represent hierarchical data. Have you seen any ones you really liked out "in the wild"? Thanks!

  • @fburton8
    @fburton8 3 года назад +3

    A really good use of pie charts is in books about visualizing data that explain why pie charts are bad for visualizing data. 😛

  • @KN-tx7sd
    @KN-tx7sd 2 года назад +1

    Hi Pat, when I try to save these pie charts the numbers corresponding to each segment are not getting displayed in the saved png or pdf file. Is this an issue with the ggsave function only for circular plots? (for bar plots no issues, the numbers are getting displayed). Is there an alternative to ggsave I could use with some modifications to display the text in the saved figures? Thank you

    • @Riffomonas
      @Riffomonas  2 года назад +1

      ggsave should save it the way you have it in the plots tab. But if you’re following the video I don’t recall there being any numbers on the pie charts…

  • @mike0133
    @mike0133 3 года назад +2

    Sorry if i am asking this to you. What is your experience on gut microbiome test? I have one. Please, if you have experience with it, can i send it to you. Please man, even few advices could be really helpful for me

    • @GabrielMorenoHagelsieb
      @GabrielMorenoHagelsieb 3 года назад

      There's a lot of videos here about performing the analyses. You'd learn a lot by watching them and doing the exercises. You could use your own data for it.

    • @Riffomonas
      @Riffomonas  3 года назад

      I think commercial analyses can be fun for those that are curious and seek them as a form of entertainment. Unfortunately, our ability to draw health care related inferences is pretty limited. I study these things for a living and couldn’t tell you what yours “means”. I strongly encourage you to talk to your doctor about any symptoms or concerns you have and to follow their advise.

  • @sitendugoswami1990
    @sitendugoswami1990 3 года назад +5

    Who makes pie charts in r? Its like saying lets show you how to use a ferrari for ploughing a field.

    • @Riffomonas
      @Riffomonas  3 года назад

      lol - don't dare me to use my Ferrari to plow my fields :) Hopefully, you'll see that this video really is more than pie charts. Also, there are a lot of "respectable" pie charts out there like radial dendrograms and genome maps - they all have the same problem as pie charts. Some are even worse!

  • @xxXXCarbon6XXxx
    @xxXXCarbon6XXxx 2 года назад +2

    A microbiologist made a Pie chart on RUclips; my comment B.cereus