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
---------------------------------
I love this video. Visually appealing charts, but the explanation is clear and concise. This is a perfect explanation and guide, thank you!
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.
Your tutorial is very informativ. Keep up the good work!
Thanks for your tutorial, it will be better if you can add more details about what each code means.
I loved the tutorial. Thank you so much
Thank you for this nice comment :)
Dude this is awesome !!
Thank you very much. I will soon upload a new video about the geom_ridgeline() function that combines density plots in a different way.
I like this tutorial, it has a good pace and explanation going along with the step. I have seen some tutorials going too fast.
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.
thank you!
Thanks a LOT!
Thanks for subscribing. Next video will come out this weekend.
Obrigada!! Vou tentar fazer !!
Eu te desejo sucesso! Obrigado pelo comentário. [Google translate]
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
thank you for the great explanation & the background music is distracting
Could you tell the names of all the libraries you use? :)
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 :)
0:12
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)
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.