SlideShare a Scribd company logo
1 of 36
www.edureka.co/r-for-analytics
R and Visualization: A Match Made in Heaven
Slide 2Slide 2Slide 2 www.edureka.co/r-for-analytics
 Have a basic understanding of Data Visualization as a field
 Create basic and advanced Graphs in R
 Change colors or use custom palettes
 Customize graphical parameters
 Learn basics of Grammar of Graphics
 Spatial analysis Visualization
What will you learn today?
Slide 3Slide 3Slide 3 www.edureka.co/r-for-analytics
Part 1 : What is Data Visualization ?
• Study of the visual representation of data
• More than pretty graphs
• Gives insights
• Helps decision making
• Accurate and truthful
Why Data Visualization?
"Lies, damned lies, and statistics" is a phrase describing the persuasive power of numbers, particularly the use
of statistics to bolster weak argument
Cue to Anscombe-Case Study
Source- Anscombe (1973) http://www.sjsu.edu/faculty/gerstman/StatPrimer/anscombe1973.pdf
Data Visualization In R
Slide 4Slide 4Slide 4 www.edureka.co/r-for-analytics
> cor(mtcars)
Part 2 : Does This Make Sense?
Data Visualization In R
Slide 5Slide 5Slide 5 www.edureka.co/r-for-analytics
Part 2 : Does This Make Better Sense?
• Library(corrgram)
• Corrgram(mtcars) RED is negative BLUE is positive
• Darker the color, more the correlation
Data Visualization In R
Slide 6Slide 6Slide 6 www.edureka.co/r-for-analytics
Part 3 : Basic graphs in R (Which one should we use and when?)
• Pie Chart (never use them)
• Scatter Plot (always use them?)
• Line Graph (Linear Trend)
• Bar Graphs (When are they better than Line graphs?)
• Sunflower plot (overplotting)
• Rug Plot
• Density Plot
• Histograms (Give us a good break!)
• Box Plots
Basic graphs in R
Slide 7Slide 7Slide 7 www.edureka.co/r-for-analytics
Part 3 : Basic graphs in R
• Plot(iris)
• Plot the entire object
• See how variables behave with each other
Basic graphs in R
Slide 8Slide 8Slide 8 www.edureka.co/r-for-analytics
Part 3 Basic graphs in R
• Plot(iris$Sepal.Length, iris$Species)
• Plot two variables at a time to closely examine relationship
Basic graphs in R
Slide 9Slide 9Slide 9 www.edureka.co/r-for-analytics
Part 3 Basic graphs in R
• Plot(iris$Species, iris$Sepal.Length)
• Plot two variables at a time
• Order is important
Hint- Keep factor variables to X axis Box Plot- Five
Numbers! minimum, first quartile, median,
third quartile, maximum.
Basic graphs in R
Slide 10Slide 10Slide 10 www.edureka.co/r-for-analytics
Part 3 : Basic graphs in R
• Plot(iris$Sepal.Length)
• Plot one variable
Scatterplot
Basic graphs in R
Slide 11Slide 11Slide 11 www.edureka.co/r-for-analytics
Part 3 : Basic graphs in R
• Plot(iris$Sepal.Length, type='l')
• Plot with type='l'
• Used if you need trend (usually with
respect to time)
Line graph
Basic graphs in R
Slide 12Slide 12Slide 12 www.edureka.co/r-for-analytics
Part 3 : Basic graphs in R
• Plot(iris$Sepal.Length, type='h') Graph
Basic graphs in R
Slide 13Slide 13Slide 13 www.edureka.co/r-for-analytics
Part 3 Basic graphs in R
• Barplot(iris$Sepal.Length)
Bar graph
Basic graphs in R
Slide 14Slide 14Slide 14 www.edureka.co/r-for-analytics
Part 3 Basic graphs in R
• Pie(table(iris$Species))
• Pie graph
• NOT Recommended
Basic graphs in R
Slide 15Slide 15Slide 15 www.edureka.co/r-for-analytics
Part 3 : Basic graphs in R
• Hist(iris$Sepal.Length)
Basic graphs in R
Slide 16Slide 16Slide 16 www.edureka.co/r-for-analytics
Part 3 : Basic graphs in R
• Hist(iris$Sepal.Length,breaks=20)
Basic graphs in R
Slide 17Slide 17Slide 17 www.edureka.co/r-for-analytics
Part 3 : Basic graphs in R
• Plot(density(iris$Sepal.Length)
Basic graphs in R
Slide 18Slide 18Slide 18 www.edureka.co/r-for-analytics
Part 3 : Basic graphs in R
• Boxplot(iris$Sepal.Length)
Boxplot
Basic graphs in R
Slide 19Slide 19Slide 19 www.edureka.co/r-for-analytics
Part 3 : Basic graphs in R
Boxplot with Rug
• Boxplot(iris$Sepal.Length)
• Rug(iris$Sepal.Length,side=2)
Adds a rug representation (1-d plot) of the data to the plot.
Basic graphs in R
Slide 20Slide 20Slide 20 www.edureka.co/r-for-analytics
Part 3 Customizing Graphs
• Multiple graphs on same screen
par(mfrow=c(3,2))
> sunflowerplot(iris$Sepal.Length)
> plot(iris$Sepal.Length)
> boxplot(iris$Sepal.Length)
> plot(iris$Sepal.Length,type="l")
> plot(density(iris$Sepal.Length))
> hist(iris$Sepal.Length)
Customizing Graphs
Slide 21Slide 21Slide 21 www.edureka.co/r-for-analytics
Part 3 : Customizing Graphs
• Multiple graphs on same screen
par(mfrow=c(3,2))
> sunflowerplot(iris$Sepal.Length)
> plot(iris$Sepal.Length)
> boxplot(iris$Sepal.Length)
> plot(iris$Sepal.Length,type="l")
> plot(density(iris$Sepal.Length))
> hist(iris$Sepal.Length)
???
Customizing Graphs
Slide 22Slide 22Slide 22 www.edureka.co/r-for-analytics
Part 3 : Customizing Graphs
• Multiple graphs on same screen
par(mfrow=c(3,2))
> sunflowerplot(iris$Sepal.Length)
> plot(iris$Sepal.Length)
> boxplot(iris$Sepal.Length)
> plot(iris$Sepal.Length,type="l")
> plot(density(iris$Sepal.Length))
> hist(iris$Sepal.Length)
Over-plotting
Customizing Graphs
Slide 23Slide 23Slide 23 www.edureka.co/r-for-analytics
Part 3 : Customizing Graphs
• X Axis, Y Axis, Title, Color
par(mfrow=c(1,2))
> plot(mtcars$mpg,mtcars$cyl,main="Example
Title",col="blue",xlab="Miles per Gallon", ylab="Number
of Cylinders")
> plot(mtcars$mpg,mtcars$cyl)
Customizing Graphs
Slide 24Slide 24Slide 24 www.edureka.co/r-for-analytics
Part 3 : Customizing Graphs
• Background
Try a variation of this yourself
par(bg="yellow")
boxplot(mtcars$mpg~mtcars$gear)
Customizing Graphs
Slide 25Slide 25Slide 25 www.edureka.co/r-for-analytics
Part 3 : Customizing Graphs
• Use Color Palettes
> par(mfrow=c(3,2))
> hist(VADeaths,col=heat.colors(7),main="col=heat.colors(7)")
> hist(VADeaths,col=terrain.colors(7),main="col=terrain.colors(7)")
> hist(VADeaths,col=topo.colors(8),main="col=topo.colors(8)")
> hist(VADeaths,col=cm.colors(8),main="col=cm.colors(8)")
> hist(VADeaths,col=cm.colors(10),main="col=cm.colors(10)")
> hist(VADeaths,col=rainbow(8),main="col=rainbow(8)")
source- http://decisionstats.com/2011/04/21/using-color-palettes-in-r/
Customizing Graphs
Slide 26Slide 26Slide 26 www.edureka.co/r-for-analytics
Part 3 : Customizing Graphs
• Use Color Palettes in RColorBrewer
> library(RColorBrewer)
> par(mfrow=c(2,3))
> hist(VADeaths,col=brewer.pal(3,"Set3"),main="Set3 3 colors")
> hist(VADeaths,col=brewer.pal(3,"Set2"),main="Set2 3 colors")
> hist(VADeaths,col=brewer.pal(3,"Set1"),main="Set1 3 colors")
> hist(VADeaths,col=brewer.pal(8,"Set3"),main="Set3 8 colors")
> hist(VADeaths,col=brewer.pal(8,"Greys"),main="Greys 8 colors")
> hist(VADeaths,col=brewer.pal(8,"Greens"),main="Greens 8 colors")
source- http://decisionstats.com/2012/04/08/color-palettes-in-r-using-rcolorbrewer-rstats/
Customizing Graphs
Slide 27Slide 27Slide 27 www.edureka.co/r-for-analytics
Part 4 Advanced Graphs
• Hexbin for over plotting
(many data points at same) library(hexbin)
plot(hexbin(iris$Species,iris$Sepal.Length))
Advanced Graphs
Slide 28Slide 28Slide 28 www.edureka.co/r-for-analytics
Part 4 Advanced Graphs
• Hexbin for over plotting(many data points are same)
library(hexbin)
plot(hexbin(mtcars$mpg,mcars$cyl))
Advanced Graphs
Slide 29Slide 29Slide 29 www.edureka.co/r-for-analytics
Part 4 : Advanced Graphs
• Tabplot for visual summary of a dataset
library(tabplot)
tableplot(iris)
Advanced Graphs
Slide 30Slide 30Slide 30 www.edureka.co/r-for-analytics
Part 4 : Advanced Graphs
• Tabplot for visual summary of a dataset
library(tabplot)
tableplot(mtcars)
Advanced Graphs
Slide 31Slide 31Slide 31 www.edureka.co/r-for-analytics
Part 4 Advanced Graphs
• Tabplot for visual summary of a dataset
• Can summarize a lot of data relatively fast
library(tabplot)
library(ggplot)
tableplot(diamonds)
Advanced Graphs
Slide 32Slide 32Slide 32 www.edureka.co/r-for-analytics
Part 4 : Advanced Graphs
• Vcd for categorical data
• Mosaic
library(vcd)
mosaic(HairEyeColor)
Advanced Graphs
Slide 33Slide 33Slide 33 www.edureka.co/r-for-analytics
Part 4 : Advanced Graphs
• Vcd for categorical data
• Mosaic
library(vcd)
mosaic(Titanic)
Advanced Graphs
Slide 34Slide 34Slide 34 www.edureka.co/r-for-analytics
Part 4 : Lots of Graphs in R
heatmap(as.matrix(mtcars))
Advanced Graphs
Slide 35Slide 35Slide 35 www.edureka.co/apache-Kafka
Get Certified in R Analytics from Edureka
Edureka's Mastering Data Analytics with R course:
• An Online course covering Techniques of Regression, Predictive Analytics, Data Mining and Sentiment Analysis.
• Online Live Courses: 24 hours
• Assignments: 30 hours
• Project: 25 hours
• Lifetime Access + 24 X 7 Support
Go to www.edureka.co/r-for-analytics
Batch starts from 10th October (Weekend Batch)
Slide 36Slide 36Slide 36 www.edureka.co/r-for-analytics
Thank You
Questions/Queries/Feedback
Recording and presentation will be made available to you within 24 hours

More Related Content

What's hot

Introduction to spatial data analysis in r
Introduction to spatial data analysis in rIntroduction to spatial data analysis in r
Introduction to spatial data analysis in r
Richard Wamalwa
 

What's hot (17)

Workshop - Hadoop + R by CARLOS GIL BELLOSTA at Big Data Spain 2013
Workshop - Hadoop + R by CARLOS GIL BELLOSTA at Big Data Spain 2013Workshop - Hadoop + R by CARLOS GIL BELLOSTA at Big Data Spain 2013
Workshop - Hadoop + R by CARLOS GIL BELLOSTA at Big Data Spain 2013
 
Advanced Analytics and Data Visualisation in Forest Management and Planning
Advanced Analytics and Data Visualisation in  Forest Management and PlanningAdvanced Analytics and Data Visualisation in  Forest Management and Planning
Advanced Analytics and Data Visualisation in Forest Management and Planning
 
20131216 Stat Journal
20131216 Stat Journal20131216 Stat Journal
20131216 Stat Journal
 
Raster package jacob
Raster package jacobRaster package jacob
Raster package jacob
 
Introduction to R for data science
Introduction to R for data scienceIntroduction to R for data science
Introduction to R for data science
 
Exploratory Analysis Part1 Coursera DataScience Specialisation
Exploratory Analysis Part1 Coursera DataScience SpecialisationExploratory Analysis Part1 Coursera DataScience Specialisation
Exploratory Analysis Part1 Coursera DataScience Specialisation
 
Introduction to spatial data analysis in r
Introduction to spatial data analysis in rIntroduction to spatial data analysis in r
Introduction to spatial data analysis in r
 
Finding Meaning in Points, Areas and Surfaces: Spatial Analysis in R
Finding Meaning in Points, Areas and Surfaces: Spatial Analysis in RFinding Meaning in Points, Areas and Surfaces: Spatial Analysis in R
Finding Meaning in Points, Areas and Surfaces: Spatial Analysis in R
 
Spatial Analysis with R - the Good, the Bad, and the Pretty
Spatial Analysis with R - the Good, the Bad, and the PrettySpatial Analysis with R - the Good, the Bad, and the Pretty
Spatial Analysis with R - the Good, the Bad, and the Pretty
 
Exponential Function
Exponential FunctionExponential Function
Exponential Function
 
Efficient Immutable Data Structures (Okasaki for Dummies)
Efficient Immutable Data Structures (Okasaki for Dummies)Efficient Immutable Data Structures (Okasaki for Dummies)
Efficient Immutable Data Structures (Okasaki for Dummies)
 
Chapter11 sorting algorithmsefficiency
Chapter11 sorting algorithmsefficiencyChapter11 sorting algorithmsefficiency
Chapter11 sorting algorithmsefficiency
 
DATA VISUALIZATION WITH R PACKAGES
DATA VISUALIZATION WITH R PACKAGESDATA VISUALIZATION WITH R PACKAGES
DATA VISUALIZATION WITH R PACKAGES
 
Heap_Sort1.pptx
Heap_Sort1.pptxHeap_Sort1.pptx
Heap_Sort1.pptx
 
Introduction to R Graphics with ggplot2
Introduction to R Graphics with ggplot2Introduction to R Graphics with ggplot2
Introduction to R Graphics with ggplot2
 
Karnaugh Map (K-map)
Karnaugh Map (K-map)Karnaugh Map (K-map)
Karnaugh Map (K-map)
 
Digitizing
DigitizingDigitizing
Digitizing
 

Viewers also liked

Viewers also liked (12)

Top 5 algorithms used in Data Science
Top 5 algorithms used in Data ScienceTop 5 algorithms used in Data Science
Top 5 algorithms used in Data Science
 
Health care and big data with hadoop – Beacuse prevention is better than cure
Health care and big data with hadoop – Beacuse prevention is better than cureHealth care and big data with hadoop – Beacuse prevention is better than cure
Health care and big data with hadoop – Beacuse prevention is better than cure
 
Power of Python with Big Data
Power of Python with Big DataPower of Python with Big Data
Power of Python with Big Data
 
Clare Corthell: Learning Data Science Online
Clare Corthell: Learning Data Science OnlineClare Corthell: Learning Data Science Online
Clare Corthell: Learning Data Science Online
 
Spark for big data analytics
Spark for big data analyticsSpark for big data analytics
Spark for big data analytics
 
Is Data Scientist still the sexiest job of 21st century? Find Out!
Is Data Scientist still the sexiest job of 21st century? Find Out!Is Data Scientist still the sexiest job of 21st century? Find Out!
Is Data Scientist still the sexiest job of 21st century? Find Out!
 
Big Data Processing with Spark and Scala
Big Data Processing with Spark and Scala Big Data Processing with Spark and Scala
Big Data Processing with Spark and Scala
 
Big Data Analytics for Non-Programmers
Big Data Analytics for Non-ProgrammersBig Data Analytics for Non-Programmers
Big Data Analytics for Non-Programmers
 
Mastering in data warehousing & BusinessIintelligence
Mastering in data warehousing & BusinessIintelligenceMastering in data warehousing & BusinessIintelligence
Mastering in data warehousing & BusinessIintelligence
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data Analytics
 
Machine Learning In Python | Python Machine Learning Tutorial | Deep Learning...
Machine Learning In Python | Python Machine Learning Tutorial | Deep Learning...Machine Learning In Python | Python Machine Learning Tutorial | Deep Learning...
Machine Learning In Python | Python Machine Learning Tutorial | Deep Learning...
 
Big Data Tutorial For Beginners | What Is Big Data | Big Data Tutorial | Hado...
Big Data Tutorial For Beginners | What Is Big Data | Big Data Tutorial | Hado...Big Data Tutorial For Beginners | What Is Big Data | Big Data Tutorial | Hado...
Big Data Tutorial For Beginners | What Is Big Data | Big Data Tutorial | Hado...
 

Similar to R and Visualization: A match made in Heaven

Week-3 – System RSupplemental material1Recap •.docx
Week-3 – System RSupplemental material1Recap •.docxWeek-3 – System RSupplemental material1Recap •.docx
Week-3 – System RSupplemental material1Recap •.docx
helzerpatrina
 
Background This course is all about data visualization. However, we.docx
Background This course is all about data visualization. However, we.docxBackground This course is all about data visualization. However, we.docx
Background This course is all about data visualization. However, we.docx
rosemaryralphs52525
 
ComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical SciencesComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical Sciences
alexstorer
 
Gis and digital_map_fundamentals
Gis and digital_map_fundamentalsGis and digital_map_fundamentals
Gis and digital_map_fundamentals
Sumant Diwakar
 
2015-10-23_wim_davis_r_slides.pptx on consumer
2015-10-23_wim_davis_r_slides.pptx on consumer2015-10-23_wim_davis_r_slides.pptx on consumer
2015-10-23_wim_davis_r_slides.pptx on consumer
tirlukachaitanya
 

Similar to R and Visualization: A match made in Heaven (20)

R programming & Machine Learning
R programming & Machine LearningR programming & Machine Learning
R programming & Machine Learning
 
Week-3 – System RSupplemental material1Recap •.docx
Week-3 – System RSupplemental material1Recap •.docxWeek-3 – System RSupplemental material1Recap •.docx
Week-3 – System RSupplemental material1Recap •.docx
 
Background This course is all about data visualization. However, we.docx
Background This course is all about data visualization. However, we.docxBackground This course is all about data visualization. However, we.docx
Background This course is all about data visualization. However, we.docx
 
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
Time-evolving Graph Processing on Commodity Clusters: Spark Summit East talk ...
 
BasicGraphsWithR
BasicGraphsWithRBasicGraphsWithR
BasicGraphsWithR
 
Big datacourse
Big datacourseBig datacourse
Big datacourse
 
Basic Analytic Techniques - Using R Tool - Part 1
Basic Analytic Techniques - Using R Tool - Part 1Basic Analytic Techniques - Using R Tool - Part 1
Basic Analytic Techniques - Using R Tool - Part 1
 
ComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical SciencesComputeFest 2012: Intro To R for Physical Sciences
ComputeFest 2012: Intro To R for Physical Sciences
 
Gis and digital_map_fundamentals
Gis and digital_map_fundamentalsGis and digital_map_fundamentals
Gis and digital_map_fundamentals
 
Machine Learning in R
Machine Learning in RMachine Learning in R
Machine Learning in R
 
Hands on data science with r.pptx
Hands  on data science with r.pptxHands  on data science with r.pptx
Hands on data science with r.pptx
 
Introduction to R for Data Science :: Session 7 [Multiple Linear Regression i...
Introduction to R for Data Science :: Session 7 [Multiple Linear Regression i...Introduction to R for Data Science :: Session 7 [Multiple Linear Regression i...
Introduction to R for Data Science :: Session 7 [Multiple Linear Regression i...
 
Introduction to R for Data Science :: Session 6 [Linear Regression in R]
Introduction to R for Data Science :: Session 6 [Linear Regression in R] Introduction to R for Data Science :: Session 6 [Linear Regression in R]
Introduction to R for Data Science :: Session 6 [Linear Regression in R]
 
R language tutorial
R language tutorialR language tutorial
R language tutorial
 
2015-10-23_wim_davis_r_slides.pptx on consumer
2015-10-23_wim_davis_r_slides.pptx on consumer2015-10-23_wim_davis_r_slides.pptx on consumer
2015-10-23_wim_davis_r_slides.pptx on consumer
 
An R primer for SQL folks
An R primer for SQL folksAn R primer for SQL folks
An R primer for SQL folks
 
Data Analytics with R and SQL Server
Data Analytics with R and SQL ServerData Analytics with R and SQL Server
Data Analytics with R and SQL Server
 
R basics
R basicsR basics
R basics
 
141222 graphulo ingraphblas
141222 graphulo ingraphblas141222 graphulo ingraphblas
141222 graphulo ingraphblas
 
141205 graphulo ingraphblas
141205 graphulo ingraphblas141205 graphulo ingraphblas
141205 graphulo ingraphblas
 

More from Edureka!

More from Edureka! (20)

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 

R and Visualization: A match made in Heaven

  • 2. Slide 2Slide 2Slide 2 www.edureka.co/r-for-analytics  Have a basic understanding of Data Visualization as a field  Create basic and advanced Graphs in R  Change colors or use custom palettes  Customize graphical parameters  Learn basics of Grammar of Graphics  Spatial analysis Visualization What will you learn today?
  • 3. Slide 3Slide 3Slide 3 www.edureka.co/r-for-analytics Part 1 : What is Data Visualization ? • Study of the visual representation of data • More than pretty graphs • Gives insights • Helps decision making • Accurate and truthful Why Data Visualization? "Lies, damned lies, and statistics" is a phrase describing the persuasive power of numbers, particularly the use of statistics to bolster weak argument Cue to Anscombe-Case Study Source- Anscombe (1973) http://www.sjsu.edu/faculty/gerstman/StatPrimer/anscombe1973.pdf Data Visualization In R
  • 4. Slide 4Slide 4Slide 4 www.edureka.co/r-for-analytics > cor(mtcars) Part 2 : Does This Make Sense? Data Visualization In R
  • 5. Slide 5Slide 5Slide 5 www.edureka.co/r-for-analytics Part 2 : Does This Make Better Sense? • Library(corrgram) • Corrgram(mtcars) RED is negative BLUE is positive • Darker the color, more the correlation Data Visualization In R
  • 6. Slide 6Slide 6Slide 6 www.edureka.co/r-for-analytics Part 3 : Basic graphs in R (Which one should we use and when?) • Pie Chart (never use them) • Scatter Plot (always use them?) • Line Graph (Linear Trend) • Bar Graphs (When are they better than Line graphs?) • Sunflower plot (overplotting) • Rug Plot • Density Plot • Histograms (Give us a good break!) • Box Plots Basic graphs in R
  • 7. Slide 7Slide 7Slide 7 www.edureka.co/r-for-analytics Part 3 : Basic graphs in R • Plot(iris) • Plot the entire object • See how variables behave with each other Basic graphs in R
  • 8. Slide 8Slide 8Slide 8 www.edureka.co/r-for-analytics Part 3 Basic graphs in R • Plot(iris$Sepal.Length, iris$Species) • Plot two variables at a time to closely examine relationship Basic graphs in R
  • 9. Slide 9Slide 9Slide 9 www.edureka.co/r-for-analytics Part 3 Basic graphs in R • Plot(iris$Species, iris$Sepal.Length) • Plot two variables at a time • Order is important Hint- Keep factor variables to X axis Box Plot- Five Numbers! minimum, first quartile, median, third quartile, maximum. Basic graphs in R
  • 10. Slide 10Slide 10Slide 10 www.edureka.co/r-for-analytics Part 3 : Basic graphs in R • Plot(iris$Sepal.Length) • Plot one variable Scatterplot Basic graphs in R
  • 11. Slide 11Slide 11Slide 11 www.edureka.co/r-for-analytics Part 3 : Basic graphs in R • Plot(iris$Sepal.Length, type='l') • Plot with type='l' • Used if you need trend (usually with respect to time) Line graph Basic graphs in R
  • 12. Slide 12Slide 12Slide 12 www.edureka.co/r-for-analytics Part 3 : Basic graphs in R • Plot(iris$Sepal.Length, type='h') Graph Basic graphs in R
  • 13. Slide 13Slide 13Slide 13 www.edureka.co/r-for-analytics Part 3 Basic graphs in R • Barplot(iris$Sepal.Length) Bar graph Basic graphs in R
  • 14. Slide 14Slide 14Slide 14 www.edureka.co/r-for-analytics Part 3 Basic graphs in R • Pie(table(iris$Species)) • Pie graph • NOT Recommended Basic graphs in R
  • 15. Slide 15Slide 15Slide 15 www.edureka.co/r-for-analytics Part 3 : Basic graphs in R • Hist(iris$Sepal.Length) Basic graphs in R
  • 16. Slide 16Slide 16Slide 16 www.edureka.co/r-for-analytics Part 3 : Basic graphs in R • Hist(iris$Sepal.Length,breaks=20) Basic graphs in R
  • 17. Slide 17Slide 17Slide 17 www.edureka.co/r-for-analytics Part 3 : Basic graphs in R • Plot(density(iris$Sepal.Length) Basic graphs in R
  • 18. Slide 18Slide 18Slide 18 www.edureka.co/r-for-analytics Part 3 : Basic graphs in R • Boxplot(iris$Sepal.Length) Boxplot Basic graphs in R
  • 19. Slide 19Slide 19Slide 19 www.edureka.co/r-for-analytics Part 3 : Basic graphs in R Boxplot with Rug • Boxplot(iris$Sepal.Length) • Rug(iris$Sepal.Length,side=2) Adds a rug representation (1-d plot) of the data to the plot. Basic graphs in R
  • 20. Slide 20Slide 20Slide 20 www.edureka.co/r-for-analytics Part 3 Customizing Graphs • Multiple graphs on same screen par(mfrow=c(3,2)) > sunflowerplot(iris$Sepal.Length) > plot(iris$Sepal.Length) > boxplot(iris$Sepal.Length) > plot(iris$Sepal.Length,type="l") > plot(density(iris$Sepal.Length)) > hist(iris$Sepal.Length) Customizing Graphs
  • 21. Slide 21Slide 21Slide 21 www.edureka.co/r-for-analytics Part 3 : Customizing Graphs • Multiple graphs on same screen par(mfrow=c(3,2)) > sunflowerplot(iris$Sepal.Length) > plot(iris$Sepal.Length) > boxplot(iris$Sepal.Length) > plot(iris$Sepal.Length,type="l") > plot(density(iris$Sepal.Length)) > hist(iris$Sepal.Length) ??? Customizing Graphs
  • 22. Slide 22Slide 22Slide 22 www.edureka.co/r-for-analytics Part 3 : Customizing Graphs • Multiple graphs on same screen par(mfrow=c(3,2)) > sunflowerplot(iris$Sepal.Length) > plot(iris$Sepal.Length) > boxplot(iris$Sepal.Length) > plot(iris$Sepal.Length,type="l") > plot(density(iris$Sepal.Length)) > hist(iris$Sepal.Length) Over-plotting Customizing Graphs
  • 23. Slide 23Slide 23Slide 23 www.edureka.co/r-for-analytics Part 3 : Customizing Graphs • X Axis, Y Axis, Title, Color par(mfrow=c(1,2)) > plot(mtcars$mpg,mtcars$cyl,main="Example Title",col="blue",xlab="Miles per Gallon", ylab="Number of Cylinders") > plot(mtcars$mpg,mtcars$cyl) Customizing Graphs
  • 24. Slide 24Slide 24Slide 24 www.edureka.co/r-for-analytics Part 3 : Customizing Graphs • Background Try a variation of this yourself par(bg="yellow") boxplot(mtcars$mpg~mtcars$gear) Customizing Graphs
  • 25. Slide 25Slide 25Slide 25 www.edureka.co/r-for-analytics Part 3 : Customizing Graphs • Use Color Palettes > par(mfrow=c(3,2)) > hist(VADeaths,col=heat.colors(7),main="col=heat.colors(7)") > hist(VADeaths,col=terrain.colors(7),main="col=terrain.colors(7)") > hist(VADeaths,col=topo.colors(8),main="col=topo.colors(8)") > hist(VADeaths,col=cm.colors(8),main="col=cm.colors(8)") > hist(VADeaths,col=cm.colors(10),main="col=cm.colors(10)") > hist(VADeaths,col=rainbow(8),main="col=rainbow(8)") source- http://decisionstats.com/2011/04/21/using-color-palettes-in-r/ Customizing Graphs
  • 26. Slide 26Slide 26Slide 26 www.edureka.co/r-for-analytics Part 3 : Customizing Graphs • Use Color Palettes in RColorBrewer > library(RColorBrewer) > par(mfrow=c(2,3)) > hist(VADeaths,col=brewer.pal(3,"Set3"),main="Set3 3 colors") > hist(VADeaths,col=brewer.pal(3,"Set2"),main="Set2 3 colors") > hist(VADeaths,col=brewer.pal(3,"Set1"),main="Set1 3 colors") > hist(VADeaths,col=brewer.pal(8,"Set3"),main="Set3 8 colors") > hist(VADeaths,col=brewer.pal(8,"Greys"),main="Greys 8 colors") > hist(VADeaths,col=brewer.pal(8,"Greens"),main="Greens 8 colors") source- http://decisionstats.com/2012/04/08/color-palettes-in-r-using-rcolorbrewer-rstats/ Customizing Graphs
  • 27. Slide 27Slide 27Slide 27 www.edureka.co/r-for-analytics Part 4 Advanced Graphs • Hexbin for over plotting (many data points at same) library(hexbin) plot(hexbin(iris$Species,iris$Sepal.Length)) Advanced Graphs
  • 28. Slide 28Slide 28Slide 28 www.edureka.co/r-for-analytics Part 4 Advanced Graphs • Hexbin for over plotting(many data points are same) library(hexbin) plot(hexbin(mtcars$mpg,mcars$cyl)) Advanced Graphs
  • 29. Slide 29Slide 29Slide 29 www.edureka.co/r-for-analytics Part 4 : Advanced Graphs • Tabplot for visual summary of a dataset library(tabplot) tableplot(iris) Advanced Graphs
  • 30. Slide 30Slide 30Slide 30 www.edureka.co/r-for-analytics Part 4 : Advanced Graphs • Tabplot for visual summary of a dataset library(tabplot) tableplot(mtcars) Advanced Graphs
  • 31. Slide 31Slide 31Slide 31 www.edureka.co/r-for-analytics Part 4 Advanced Graphs • Tabplot for visual summary of a dataset • Can summarize a lot of data relatively fast library(tabplot) library(ggplot) tableplot(diamonds) Advanced Graphs
  • 32. Slide 32Slide 32Slide 32 www.edureka.co/r-for-analytics Part 4 : Advanced Graphs • Vcd for categorical data • Mosaic library(vcd) mosaic(HairEyeColor) Advanced Graphs
  • 33. Slide 33Slide 33Slide 33 www.edureka.co/r-for-analytics Part 4 : Advanced Graphs • Vcd for categorical data • Mosaic library(vcd) mosaic(Titanic) Advanced Graphs
  • 34. Slide 34Slide 34Slide 34 www.edureka.co/r-for-analytics Part 4 : Lots of Graphs in R heatmap(as.matrix(mtcars)) Advanced Graphs
  • 35. Slide 35Slide 35Slide 35 www.edureka.co/apache-Kafka Get Certified in R Analytics from Edureka Edureka's Mastering Data Analytics with R course: • An Online course covering Techniques of Regression, Predictive Analytics, Data Mining and Sentiment Analysis. • Online Live Courses: 24 hours • Assignments: 30 hours • Project: 25 hours • Lifetime Access + 24 X 7 Support Go to www.edureka.co/r-for-analytics Batch starts from 10th October (Weekend Batch)
  • 36. Slide 36Slide 36Slide 36 www.edureka.co/r-for-analytics Thank You Questions/Queries/Feedback Recording and presentation will be made available to you within 24 hours