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

  Рет қаралды 13,395

The Data Digest

The Data Digest

Күн бұрын

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 Жыл бұрын
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 жыл бұрын
Your tutorial is very informativ. Keep up the good work!
@suying-meow
@suying-meow 4 ай бұрын
Thanks for your tutorial, it will be better if you can add more details about what each code means.
@chikuniepraise3481
@chikuniepraise3481 2 жыл бұрын
I loved the tutorial. Thank you so much
@TheDataDigest
@TheDataDigest 2 жыл бұрын
Thank you for this nice comment :)
@AnseloSilver
@AnseloSilver 3 ай бұрын
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.
@bhargavapothakamuri4218
@bhargavapothakamuri4218 2 жыл бұрын
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.
@dra.thaisdinizreis
@dra.thaisdinizreis 2 жыл бұрын
thank you!
@portillanath
@portillanath 2 жыл бұрын
Thanks a LOT!
@TheDataDigest
@TheDataDigest 2 жыл бұрын
Thanks for subscribing. Next video will come out this weekend.
@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
@keylavitoria2588
@keylavitoria2588 2 жыл бұрын
Obrigada!! Vou tentar fazer !!
@TheDataDigest
@TheDataDigest 2 жыл бұрын
Eu te desejo sucesso! Obrigado pelo comentário. [Google translate]
@suheylaaydemir8728
@suheylaaydemir8728 8 ай бұрын
thank you for the great explanation & the background music is distracting
@DomenicaJosefina
@DomenicaJosefina 2 ай бұрын
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 2 жыл бұрын
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.
@bhargavapothakamuri4218
@bhargavapothakamuri4218 Жыл бұрын
0:12
Data visualization with R in 36 minutes
36:16
Equitable Equations
Рет қаралды 25 М.
THEY made a RAINBOW M&M 🤩😳 LeoNata family #shorts
00:49
LeoNata Family
Рет қаралды 35 МЛН
Can You Draw A PERFECTLY Dotted Line?
00:55
Stokes Twins
Рет қаралды 110 МЛН
Became invisible for one day!  #funny #wednesday #memes
00:25
Watch Me
Рет қаралды 56 МЛН
How to Create Bubble Charts in R with geom_point() and scale_size()
18:46
Histograms and Density Plots with {ggplot2}
8:34
yuzaR Data Science
Рет қаралды 3 М.
How to combine multiple plots in R with cowplot and ggplot2 (CC098)
20:16
Riffomonas Project
Рет қаралды 20 М.
9 R packages that EVERY Data Scientist must know (in 9-minutes)
9:26
Business Science
Рет қаралды 3,8 М.
How to create Multi-Panel plots in R with facet_wrap() and facet_grid()
23:45
How to Create Parallel Plots in R with geom_line() and ggparcoord()
15:09
GGplot2 в R, основы графики
26:41
Черный программист
Рет қаралды 1 М.
THEY made a RAINBOW M&M 🤩😳 LeoNata family #shorts
00:49
LeoNata Family
Рет қаралды 35 МЛН