## Plotting in R tutorial: Gorgeous graphs with ggplot2

Learn how to use the ggplot2 library in R to plot nice-looking graphs and find out how to customize them in this step-by-step guide.

Downloadable data is available to use with this tutorial at https://deltadna.com/blog/plotting-in-r-tutorial/ as is a written version.

Please note that the data source has now changed from ‘demo-co.deltacrunch’ to ‘demo-account.demo-game’ & all login details have been changed.

Working with times using lubridate 03:05
Your first ggplot 05:58
Different geoms 08:37
Fixed variables and aesthetics 09:05
Faceting 11:44
Histograms 13:00
Converting a variable into a factor and accessing help 14:05
Bar graphs 16:05
Stacked bar graphs 17:07
Grouped bar graphs 18:34
Proportion bar graphs 20:06
Basic heatplot 21:30
Advanced heatplot, including labels, new colours and text 25:54

• Views:81,934 views
• Rating:
•  Click on the stars above to rate this page
• Categories:
• Tags:

Benj Lopez says:

Hi! Should I still use the query for the CSV file I got from the link?

good tutorial but you don’t have to do this if you don’t want to, are you for real with yawning

Germán López-Campos says:

Hi, out of curiosity where’s your accent from, you really pronounce the H in ‘what’, ‘which’, etc., thanks for the tutorial also!

Ajeetz CreativeLab says:

Loved that YAWN!!!!! at 14:00.

A good tutorial by the way. Nice clarity of video and audio quality makes it easy to focus on content.

Hey 21 says:

set.seed(10)
install.packages(“data.table”)
library(data.table)
tabulka = data.table(A = rnorm(10),
B = 1:10,
C= 10:1,
D= rep(c(“a”,”b”),each=5)
)
tabulka[2,1]=NA
tabulka[4,1]=NA
tabulka

tabulka[c(1,3,5,6,7,8,9,10),mean(A)]
tabulka[,E:=B^2]
tabulka[,F:=sum(B),by=D]

Henry Mazhokota says:

This is a very clear tutorial. Thank you very much.

Nick DeCoursin says:

Thank you so much!

Steven Lam says:

There’s no link for the query.

Chuck says:

sexy brit accent.

vishnu Nandhyala says:

Hi,
Can you send the data to my mail id vshn22519@gmail.com

Brandon S. says:

Thanks for yawning in my ear. Good stuff.

Tantely Hoby Hasina Andriana says:

thanks ! Great tutorial

Ismaiel Ahmed says:

if i have categorical values like (Bad , Good, V Good, Excellent) .. How i can order those values in Histogram bar plot …

Jenna Proctor says:

So I want to plot different stress and food factors along the x axis and distance along the y how do I go about putting this in the the script you showed? I didn’t really get how you scripted them

Rajdeep Banerjee says:

This is very helpful. Thank you.

Doreen Lim says:

I can’t seem to find the downloadable data and tutorial after signing up for the page. Could you advise? 🙂

Alex Torres says:

im using R for powerbi, and i have a looot of columns with spaces, how to deal with spaces ?