Density Plot in R with ggplot and geom_density() [R-Graph Gallery Tutorial]

Поделиться
HTML-код
  • Опубликовано: 15 июл 2024
  • In this tutorial I show how to create Density Charts in R with ggplot() and geom_density(). The examples are based in the R-Graph Gallery. I show how density charts are different form histograms and how to visualize multiple different distributions at once.
    I also describe how to annotate them and how to add them to the margins of scatter plots.
    ⏱ Time Stamps ⌚
    0:00​ - Intro and video overview
    1:40​ - Histogram and density plot differences
    3:50​ - geom_density() function arguments
    6:01​ - Mirror density plot
    6:37​ - Multiple density plots
    8:43​ - Annotation with geom_text()
    10:10 - Marginal distributions
    10:40 - Density plot and boxplot infographic on powerlifting
    External Links:
    www.r-graph-gallery.com/densi...
    www.data-to-viz.com/graph/den...
    en.wikipedia.org/wiki/Kernel_...
    github.com/sianbladon/Data-Vi...
    github.com/sianbladon/Data-Vi...
    ♫ Background Music ♪
    "Sappheiros - Dawn" is under a Creative Commons license (CC BY 3.0)
    Music promoted by BreakingCopyright: bit.ly/2OBe00v​​
    ---------------------------------
    Music : Way Home by Tokyo Music Walker
    Stream & Download : fanlink.to/tmw_way_home​
    Creative Commons - Attribution 3.0 Unported - CC BY 3.0
    ---------------------------------
    Ambient Music (No Copyright) "Art Of Silence" by Uniq 🇳🇴
    "Uniq - Art Of Silence" is under a Creative Commons license (CC BY-NC-SA 3.0)
    Music promoted by BreakingCopyright: bit.ly/uniq-art-of-silence
    ---------------------------------

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

  • @DreamptLife
    @DreamptLife Год назад +2

    I love this video. Visually appealing charts, but the explanation is clear and concise. This is a perfect explanation and guide, thank you!

    • @TheDataDigest
      @TheDataDigest  Год назад

      And I love your comment. Really glad that it is so highly appreciated by you. I hope to make many more such videos and that they will find subscribers like you that will watch and enjoy them.

  • @m3ick
    @m3ick 3 года назад +1

    Your tutorial is very informativ. Keep up the good work!

  • @suying-meow
    @suying-meow 4 месяца назад +1

    Thanks for your tutorial, it will be better if you can add more details about what each code means.

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

    I loved the tutorial. Thank you so much

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

    Dude this is awesome !!

    • @TheDataDigest
      @TheDataDigest  2 года назад

      Thank you very much. I will soon upload a new video about the geom_ridgeline() function that combines density plots in a different way.

  • @AnseloSilver
    @AnseloSilver 3 месяца назад +1

    I like this tutorial, it has a good pace and explanation going along with the step. I have seen some tutorials going too fast.

    • @TheDataDigest
      @TheDataDigest  2 месяца назад

      Feedback like this is highly appreciative. Thanks for leaving a comment. I do cut out all unnecessary speech so my videos are actually quite fast. But I want to show a lot and one can always rewind and watch again.

  • @dra.thaisdinizreis
    @dra.thaisdinizreis 2 года назад +1

    thank you!

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

    Thanks a LOT!

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

      Thanks for subscribing. Next video will come out this weekend.

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

    Obrigada!! Vou tentar fazer !!

    • @TheDataDigest
      @TheDataDigest  2 года назад

      Eu te desejo sucesso! Obrigado pelo comentário. [Google translate]

  • @khando
    @khando Год назад

    If you were to add lower and upper bounds as shade to the density plot (density on the y axis) as ribbon, how would you do it? I am asking this because I am stuck with a similar problem for myself

  • @suheylaaydemir8728
    @suheylaaydemir8728 8 месяцев назад

    thank you for the great explanation & the background music is distracting

  • @DomenicaJosefina
    @DomenicaJosefina 2 месяца назад +1

    Could you tell the names of all the libraries you use? :)

    • @TheDataDigest
      @TheDataDigest  2 месяца назад

      I think in this video I only used ggplot2 library. It is part of the tidyverse package, which also includes dplyr. I also often use forcats (to work with factors), lubridate (to work with dates), and stringr (to manipulate strings).
      I also saw this tweet today about using ggdist package for distribution plots (twitter.com/MatthewBJane/status/1780952366541385910).
      Hope that helps :)

  • @bhargavapothakamuri4218
    @bhargavapothakamuri4218 Год назад

    0:12

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

    Thanks bro !
    Can you gimme your email, I have a question regarding gather and spread. And also Transpose function (curiously the transpose function is changing DF to a Double type)

    • @TheDataDigest
      @TheDataDigest  2 года назад

      Hi Bhargave, I recommend to go to "stackoverflow" and post your questions there. If you give a reproducible example you will get solutions and answers within a few days by competent users. Maybe I even see your question there and can answer it. Thanks for watching my videos.