FULL CODE AND DESCRIPTION:
DESCRIPTION:
ggplot2 is an incredibly powerful tool to create great charts with R. But it has a bit of a learning curve. This tutorial shows you everything you need to know to get started with ggplot in 45 minutes
FULL CODE:
The corresponding blog post to this video (including the full code) can be found at https://albert-rapp.de/posts/ggplot2-tips/18_ultimate_guide/18_ultimate_guide
WANT TO GET EVEN BETTER?
You have started to learn the mechanics of ggplot. That's a great start. But if you want to create insightful charts, then you will have to combine ggplot with data visualization principles. If you're interested in that, then check out my video course at https://arapp.thinkific.com/courses/insightful-data-visualizations-for-uncreative-r-users
LINKS TO THINGS I'VE MENTIONED:
🔗 Quarto: If you've never used Quarto files to mix texts and code chunks, then you can find all of that information about this incredibly powerful tool at https://quarto.org/
🔗 TidyTuesday: https://github.com/rfordatascience/tidytuesday
🔗 Allison Horst: The idea to create an ugly chart to learn the mechanics first wasn't my idea. I picked that up from one of Allison's blog posts. You should check out here website (and her great educational cartoons) at https://allisonhorst.com/
MORE VIDEOS
📺 Avoid duplicate R code in 150 seconds
https://youtu.be/E0I-G6rWESQ
📺 Shiny modules in 100 seconds
https://youtu.be/BufC0agHnzw
📺 Fast explainer playlist https://www.youtube.com/playlist?list=PLBnFxG6owe1EzWjq_rOfdWcWP8QBxcm58
Subscribe at 👉 https://www.youtube.com/channel/UCdFC653IaBVC5kwj7CGo2sQ?sub_confirmation=1
MORE CONTENT
- weekly 3-minute newsletter about R, DataViz and webdev at https://alberts-newsletter.beehiiv.com/subscribe
- LinkedIn at https://www.linkedin.com/in/dr-albert-rapp-9a5b9b28b/
#rstats #dataviz #ggplot2
TIMECODES
00:00 Intro
00:30 First Chart
01:43 What the heck is aes()?
03:50 Why coordinates in aes() & scales?
05:07 Use a real data set
06:19 Set aesthetics to fixed values
07:20 Make color dependent on data
09:30 Avoid code repetition
10:12 Nicer labels & titles
10:58 theme_*() layer and font size
11:38 theme() function: using values for changes
12:50: theme() function: using elements
15:29: Try out scales
16:21 Our first bar chart
17:50 Statistical transformations
19:00 Trying to work with statistical transformation
20:30 Identical statistical transformation
21:20 Creating a histogram with a stat_* layer
22:40 Connection between stat and geom layers
24:10 Easier layers without touching stat
24:45 Add labels to bar chart
27:00 Formatting the labels
27:45 Change color of bars
28:40 Remove more duplicate code
29:40 Split histogram by sex
31:30 Change positioning of colored histograms
33:03 More position changes (dodge and jitter)
35:44 Use multiple windows for different histograms
37:00 Putting it all together with a new data set
44:20 How to learn more?
45:02 Shameless plug & outro