• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Data Visualizing with R
 

Data Visualizing with R

on

  • 909 views

We look at various scenarios where data visualization is required and see what are the appropriate R functions/tools to use

We look at various scenarios where data visualization is required and see what are the appropriate R functions/tools to use

Statistics

Views

Total Views
909
Views on SlideShare
863
Embed Views
46

Actions

Likes
6
Downloads
0
Comments
0

1 Embed 46

https://hasgeek.tv 46

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Data Visualizing with R Data Visualizing with R Presentation Transcript

    • Data Visualization with Baan Bapat Baan Bapat Data Visualization with R
    • Univariate Continuous Birth-weight length(bw) [1] 2700 summary(bw) Min. 1st Qu. Median Mean 3rd Qu. Max. 1.927 2.390 2.580 2.613 2.778 3.454 boxplot(bw, horizontal=TRUE, notch=TRUE, col="gold") qqqqqqq qq qqqq qqq qqqqq qqqqq 2.0 2.5 3.0 3.5 Baan Bapat Data Visualization with R
    • Univariate Continuous Birth-weight length(bw) [1] 2700 summary(bw) Min. 1st Qu. Median Mean 3rd Qu. Max. 1.927 2.390 2.580 2.613 2.778 3.454 boxplot(bw, horizontal=TRUE, notch=TRUE, col="gold") qqqqqqq qq qqqq qqq qqqqq qqqqq 2.0 2.5 3.0 3.5 Baan Bapat Data Visualization with R
    • Univariate Continuous Birth-weight length(bw) [1] 2700 summary(bw) Min. 1st Qu. Median Mean 3rd Qu. Max. 1.927 2.390 2.580 2.613 2.778 3.454 boxplot(bw, horizontal=TRUE, notch=TRUE, col="gold") qqqqqqq qq qqqq qqq qqqqq qqqqq 2.0 2.5 3.0 3.5 Baan Bapat Data Visualization with R
    • Univariate Continuous Birth-weight length(bw) [1] 2700 summary(bw) Min. 1st Qu. Median Mean 3rd Qu. Max. 1.927 2.390 2.580 2.613 2.778 3.454 boxplot(bw, horizontal=TRUE, notch=TRUE, col="gold") qqqqqqq qq qqqq qqq qqqqq qqqqq 2.0 2.5 3.0 3.5 Baan Bapat Data Visualization with R
    • Boxplot Univariate Continuous qqqqqqq qq qqqq qqqqqqqqqqqqq boxplot() q qq robustbase::adjbox() 2.0 2.5 3.0 3.5 q vioplot::vioplot() par(mfrow=c(3,1)) boxplot(bw, ...) robustbase::adjbox(bw, notch=TRUE, cex=2, col="skyblue", lwd=1.5, main="...") vioplot::vioplot(bw, col="lightgreen") title("...") Baan Bapat Data Visualization with R
    • Boxplot Univariate Continuous qqqqqqq qq qqqq qqqqqqqqqqqqq boxplot() q qq robustbase::adjbox() 2.0 2.5 3.0 3.5 q vioplot::vioplot() par(mfrow=c(3,1)) boxplot(bw, ...) robustbase::adjbox(bw, notch=TRUE, cex=2, col="skyblue", lwd=1.5, main="...") vioplot::vioplot(bw, col="lightgreen") title("...") Baan Bapat Data Visualization with R
    • Boxplot Univariate Continuous qqqqqqq qq qqqq qqqqqqqqqqqqq boxplot() q qq robustbase::adjbox() 2.0 2.5 3.0 3.5 q vioplot::vioplot() par(mfrow=c(3,1)) boxplot(bw, ...) robustbase::adjbox(bw, notch=TRUE, cex=2, col="skyblue", lwd=1.5, main="...") vioplot::vioplot(bw, col="lightgreen") title("...") Baan Bapat Data Visualization with R
    • Boxplot Univariate Continuous qqqqqqq qq qqqq qqqqqqqqqqqqq boxplot() q qq robustbase::adjbox() 2.0 2.5 3.0 3.5 q vioplot::vioplot() par(mfrow=c(3,1)) boxplot(bw, ...) robustbase::adjbox(bw, notch=TRUE, cex=2, col="skyblue", lwd=1.5, main="...") vioplot::vioplot(bw, col="lightgreen") title("...") Baan Bapat Data Visualization with R
    • Histogram Univariate Continuous Histogram of birth weight Weight (kg) Frequency 2.0 2.5 3.0 3.5 0100200300400 5 35 127 249 271 346 387 393 281 176 87 95 108 88 45 6 1 hist(bw, xlab="Weight (kg)", ylab="Frequency", labels=TRUE, ...) Baan Bapat Data Visualization with R
    • Histogram & density Univariate Continuous Histogram & Density line: Birth weight Weight (kg) Probability 2.0 2.5 3.0 3.5 0.00.51.01.5 hist(..., freq=FALSE) lines(density(bw), ...) Baan Bapat Data Visualization with R
    • Histogram & density Univariate Continuous Histogram & Density line: Birth weight Weight (kg) Probability 2.0 2.5 3.0 3.5 0.00.51.01.5 hist(..., freq=FALSE) lines(density(bw), ...) Baan Bapat Data Visualization with R
    • Histogram & density Univariate Continuous Histogram & Density lines: Birth weight mixtures? Weight (kg) Probability 2.0 2.5 3.0 3.5 0.00.51.01.5 More breaks in hist Baan Bapat Data Visualization with R
    • Histogram & density Univariate Continuous Histogram & Density lines: Birth weight mixtures? Weight (kg) Probability 2.0 2.5 3.0 3.5 0.00.51.01.5 More breaks in hist Density mixture Baan Bapat Data Visualization with R
    • Histogram & density Univariate Continuous Histogram & Density lines: Birth weight mixtures? Weight (kg) Probability 2.0 2.5 3.0 3.5 0.00.51.01.5 More breaks in hist Density mixture Baan Bapat Data Visualization with R
    • Histogram & adjusted boxplot Univariate Continuous Histogram, Density & Adjbox bw Density 0.00.51.01.5 q q q 2.0 2.5 3.0 3.5 Weight (kg) mat <- matrix(c(1,2)) layout(mat, height=c(0.8, 0.2)) par(mar= c(0,4,3,1), bty="n") hist(..., , axes=FALSE) axis(2) boxplot() Baan Bapat Data Visualization with R
    • Histogram & adjusted boxplot Univariate Continuous Histogram, Density & Adjbox bw Density 0.00.51.01.5 q q q 2.0 2.5 3.0 3.5 Weight (kg) mat <- matrix(c(1,2)) layout(mat, height=c(0.8, 0.2)) par(mar= c(0,4,3,1), bty="n") hist(..., , axes=FALSE) axis(2) boxplot() Baan Bapat Data Visualization with R
    • Histogram & adjusted boxplot Univariate Continuous Histogram, Density & Adjbox bw Density 0.00.51.01.5 q q q 2.0 2.5 3.0 3.5 Weight (kg) mat <- matrix(c(1,2)) layout(mat, height=c(0.8, 0.2)) par(mar= c(0,4,3,1), bty="n") hist(..., , axes=FALSE) axis(2) boxplot() Baan Bapat Data Visualization with R
    • Histogram & adjusted boxplot Univariate Continuous Histogram, Density & Adjbox bw Density 0.00.51.01.5 q q q 2.0 2.5 3.0 3.5 Weight (kg) mat <- matrix(c(1,2)) layout(mat, height=c(0.8, 0.2)) par(mar= c(0,4,3,1), bty="n") hist(..., , axes=FALSE) axis(2) boxplot() Baan Bapat Data Visualization with R
    • Histogram & adjusted boxplot Univariate Continuous Histogram, Density & Adjbox bw Density 0.00.51.01.5 q q q 2.0 2.5 3.0 3.5 Weight (kg) mat <- matrix(c(1,2)) layout(mat, height=c(0.8, 0.2)) par(mar= c(0,4,3,1), bty="n") hist(..., , axes=FALSE) axis(2) boxplot() Baan Bapat Data Visualization with R
    • Histogram & adjusted boxplot Univariate Continuous Histogram, Density & Adjbox bw Density 0.00.51.01.5 q q q 2.0 2.5 3.0 3.5 Weight (kg) mat <- matrix(c(1,2)) layout(mat, height=c(0.8, 0.2)) par(mar= c(0,4,3,1), bty="n") hist(..., , axes=FALSE) axis(2) boxplot() Baan Bapat Data Visualization with R
    • QQ plot – for the statistically inclined Univariate Continuous q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q qq q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q qqqq q q q q qq q q q q q q q q q q q q qq q q q q q q q q qq q qq q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q qq q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q qq q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qqq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q qq q q q q q q qq q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q qq q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qqq q q q q q q q q q q q qq q q q q q q q q qq q q q q q qq q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q qq q q q q q qq q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q qq qq q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q qqq q q q q q q q qq q q q q q qq q q q qq q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q qqq q q q q q q q q q q q q q q qqq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q qqq q q q q q q q q q q q q q q q q q q q qq q qq q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q qq q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q qq qq q q q q qq q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q qq q q qq q q q q qqq q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q qqqq q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q qq q qq q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q qq q q q q q q qq q q q q q q q q q q q q q q q qq q q q q q q qq q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q qq q q qq q q q q q q q q q q q q q qq q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q qqq q q q q q q q qq q q q q qq q q q q q q q q q q q q q qq qqq q q q q q q q qq q q q q q q q q q qq q q qq q q q q q q q q q qq q q q q q q q q q qq q q q qq q q q q q qq q qq q q q q q qq q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q qq q qq q q q q q q q q q q q q q q qq q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q qq q q q q q q q q qq q q q q q q q q q q q q q q q q qq q q q q q qq q q q q q q q q q q q q q q q q q qq q q q q q q q q q q qq q q q q q qq q q q q q q q q q q q q q qq q q q q q q q qqq q q q q q q qq q q q q q q q q q q q q q qq q q q q q q q q q q qq q q q q q q q qq q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q qq q q q q q q q q q q q qq qq q q q q q q qq qq q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q qq qq q q q q q q q q qq q qq q q q q q q q q q q q q qqq q q qqq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q qq q q q q qq q q q q q q q q q q qq q q q q q q q q qq qq q q q q −3 −2 −1 0 1 2 3 2.02.53.03.5 Normal Q−Q Plot Theoretical Quantiles SampleQuantiles qqnorm(bw, col="blue", pch=16) qqline(bw, col="red", lwd=2) Baan Bapat Data Visualization with R
    • QQ plot – for the statistically inclined Univariate Continuous q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q qq q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q qqqq q q q q qq q q q q q q q q q q q q qq q q q q q q q q qq q qq q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q qq q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q qq q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qqq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q qq q q q q q q qq q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q qq q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qqq q q q q q q q q q q q qq q q q q q q q q qq q q q q q qq q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q qq q q q q q qq q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q qq qq q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q qqq q q q q q q q qq q q q q q qq q q q qq q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q qqq q q q q q q q q q q q q q q qqq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q qqq q q q q q q q q q q q q q q q q q q q qq q qq q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q qq q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q qq qq q q q q qq q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q qq q q qq q q q q qqq q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q qqqq q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q qq q qq q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q qq q q q q q q qq q q q q q q q q q q q q q q q qq q q q q q q qq q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q qq q q qq q q q q q q q q q q q q q qq q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q qqq q q q q q q q qq q q q q qq q q q q q q q q q q q q q qq qqq q q q q q q q qq q q q q q q q q q qq q q qq q q q q q q q q q qq q q q q q q q q q qq q q q qq q q q q q qq q qq q q q q q qq q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q qq q qq q q q q q q q q q q q q q q qq q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q qq q q q q q q q q qq q q q q q q q q q q q q q q q q qq q q q q q qq q q q q q q q q q q q q q q q q q qq q q q q q q q q q q qq q q q q q qq q q q q q q q q q q q q q qq q q q q q q q qqq q q q q q q qq q q q q q q q q q q q q q qq q q q q q q q q q q qq q q q q q q q qq q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q qq q q q q q q q q q q q qq qq q q q q q q qq qq q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q qq qq q q q q q q q q qq q qq q q q q q q q q q q q q qqq q q qqq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q qq q q q q qq q q q q q q q q q q qq q q q q q q q q qq qq q q q q −3 −2 −1 0 1 2 3 2.02.53.03.5 Normal Q−Q Plot Theoretical Quantiles SampleQuantiles qqnorm(bw, col="blue", pch=16) qqline(bw, col="red", lwd=2) Baan Bapat Data Visualization with R
    • Univariate Categorical Topics most visited on English Wikipedia on 31 May 2013 Topic No. hits Cult 291439 Rituparno Ghosh 215843 Cat anatomy 102960 Facebook 93181 Fast & Furious 6 84014 Liberace 73162 Game of Thrones 70599 Jean-Claude Romand 70144 Game of Thrones (season 3) 69752 Arrested Development (TV series) 69573 Baan Bapat Data Visualization with R
    • Barplot Univariate Categorical Arrested Development (TV) Game of Thrones (season 3) Jean−Claude Romand Game of Thrones Liberace Fast & Furious 6 Facebook Cat anatomy Rituparno Ghosh Cult 0 50000 100000 150000 200000 250000 69573 69752 70144 70599 73162 84014 93181 102960 215843 291439 n <- length(wiki) bp <- barplot(wiki, horiz=TRUE, col=topo.colors(n)) text(y=bp, x=wiki, labels=wiki, cex=0.8, pos=2) Baan Bapat Data Visualization with R
    • Barplot Univariate Categorical Arrested Development (TV) Game of Thrones (season 3) Jean−Claude Romand Game of Thrones Liberace Fast & Furious 6 Facebook Cat anatomy Rituparno Ghosh Cult 0 50000 100000 150000 200000 250000 69573 69752 70144 70599 73162 84014 93181 102960 215843 291439 n <- length(wiki) bp <- barplot(wiki, horiz=TRUE, col=topo.colors(n)) text(y=bp, x=wiki, labels=wiki, cex=0.8, pos=2) Baan Bapat Data Visualization with R
    • Barplot Univariate Categorical Arrested Development (TV) Game of Thrones (season 3) Jean−Claude Romand Game of Thrones Liberace Fast & Furious 6 Facebook Cat anatomy Rituparno Ghosh Cult 0 50000 100000 150000 200000 250000 69573 69752 70144 70599 73162 84014 93181 102960 215843 291439 n <- length(wiki) bp <- barplot(wiki, horiz=TRUE, col=topo.colors(n)) text(y=bp, x=wiki, labels=wiki, cex=0.8, pos=2) Baan Bapat Data Visualization with R
    • Barplot – two axes Univariate Categorical Frequency Cult rnoGhosh tanatomy Facebook Furious6 Liberace ofThrones eRomand (season3) ment(TV) 1e+051500002e+052500003e+05 q q q q q q q q q q 00.20.40.60.81 Cumm.proportion pwiki <- cumsum( prop.table(wiki)) twoord.plot(lx=n, ly=wiki, rx=n, ry=pwiki, ylab=..., rylab=..., rpch=16, rylim=c(0,1), type=c("bar", "b"), lcol=..., rcol=..., xticklab=...) Baan Bapat Data Visualization with R
    • Barplot – two axes Univariate Categorical Frequency Cult rnoGhosh tanatomy Facebook Furious6 Liberace ofThrones eRomand (season3) ment(TV) 1e+051500002e+052500003e+05 q q q q q q q q q q 00.20.40.60.81 Cumm.proportion pwiki <- cumsum( prop.table(wiki)) twoord.plot(lx=n, ly=wiki, rx=n, ry=pwiki, ylab=..., rylab=..., rpch=16, rylim=c(0,1), type=c("bar", "b"), lcol=..., rcol=..., xticklab=...) Baan Bapat Data Visualization with R
    • Pie Univariate Categorical Arrested Development (TV) Game of Thrones (season 3) Jean−Claude Romand Game of Thrones Liberace Fast & Furious 6 Facebook Cat anatomy Rituparno Ghosh Cult pie(wiki, init.angle=90) Baan Bapat Data Visualization with R
    • Exploded pie Univariate Categorical Arrested Development (TV) Game of Thrones (season 3) Jean−Claude Romand Game of ThronesLiberace Fast & Furious 6 Facebook Cat anatomy Rituparno Ghosh Cult require(plotrix) pie3D(wiki, labels=names(wiki), explode=0.1) Baan Bapat Data Visualization with R
    • Exploded pie Univariate Categorical Arrested Development (TV) Game of Thrones (season 3) Jean−Claude Romand Game of ThronesLiberace Fast & Furious 6 Facebook Cat anatomy Rituparno Ghosh Cult require(plotrix) pie3D(wiki, labels=names(wiki), explode=0.1) Baan Bapat Data Visualization with R
    • Dotchart Univariate Categorical Arrested Development (TV) Game of Thrones (season 3) Jean−Claude Romand Game of Thrones Liberace Fast & Furious 6 Facebook Cat anatomy Rituparno Ghosh Cult q q q q q q q q q q 100000 200000 300000 dotchart(wiki, pch=19, col=rainbow(n)) Baan Bapat Data Visualization with R
    • Bivariate Categorical Hair & Eye color data on 500 odd students Baan Bapat Data Visualization with R
    • Barplot Bivariate Categorical Black Brown Red Blond Hair color Eyecolorfrequency 020406080100120140 Brown Blue Hazel Green Stacked bar plot barplot( HairEyeColor) legend( x="topright", legend = attr(HairEyeColor, "dimnames")$Eye, pch=18, col=mycols) Baan Bapat Data Visualization with R
    • Barplot Bivariate Categorical Black Brown Red Blond Hair color Eyecolorfrequency 020406080100120140 Brown Blue Hazel Green Stacked bar plot barplot( HairEyeColor) legend( x="topright", legend = attr(HairEyeColor, "dimnames")$Eye, pch=18, col=mycols) Baan Bapat Data Visualization with R
    • Barplot Bivariate Categorical Black Brown Red Blond Hair color Eyecolorfrequency 020406080100120140 Brown Blue Hazel Green Stacked bar plot barplot( HairEyeColor) legend( x="topright", legend = attr(HairEyeColor, "dimnames")$Eye, pch=18, col=mycols) Baan Bapat Data Visualization with R
    • Barplot Bivariate Categorical Black Brown Red Blond Hair color Eyecolorfrequency 0102030405060 Brown Blue Hazel Green Grouped bar plot barplot(..., beside=TRUE) Baan Bapat Data Visualization with R
    • Barplot Bivariate Categorical Black Brown Red Blond Hair color Eyecolorfrequency 0102030405060 Brown Blue Hazel Green Grouped bar plot barplot(..., beside=TRUE) Baan Bapat Data Visualization with R
    • Mosaicplot Bivariate Categorical Hair Eye Black Brown Red Blond BrownBlueHazelGreen Mosaic grid mosaicplot( HairEyeColor) Baan Bapat Data Visualization with R
    • Mosaicplot Bivariate Categorical Hair Eye Black Brown Red Blond BrownBlueHazelGreen Mosaic grid mosaicplot( HairEyeColor) Baan Bapat Data Visualization with R
    • Cars data Fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973–74 models), . . . Motor Trend dataset: mtcars Baan Bapat Data Visualization with R
    • Boxplot Bivariate Continuous Vs Categorical qq 4 6 8 1015202530 Cylinders Milespergallon Car Mileage ∼ cylinders boxplot(mpg ∼ cyl, data=mtcars) Baan Bapat Data Visualization with R
    • Boxplot Bivariate Continuous Vs Categorical qq 4 6 8 1015202530 Cylinders Milespergallon Car Mileage ∼ cylinders boxplot(mpg ∼ cyl, data=mtcars) Baan Bapat Data Visualization with R
    • Scatterplot Bivariate Continuous Vs Continuous q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 2 3 4 5 1015202530 Car Weight MilesPerGallon Car Mileage ∼ weight with(mtcars, plot(x=wt, y=mpg, xlab="...", ylab="...", pch=19, col="darkblue") ) identify(), locator(), grid() Baan Bapat Data Visualization with R
    • Scatterplot Bivariate Continuous Vs Continuous q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 2 3 4 5 1015202530 Car Weight MilesPerGallon Car Mileage ∼ weight with(mtcars, plot(x=wt, y=mpg, xlab="...", ylab="...", pch=19, col="darkblue") ) identify(), locator(), grid() Baan Bapat Data Visualization with R
    • Scatterplot Bivariate Continuous Vs Continuous q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 2 3 4 5 1015202530 Car Weight MilesPerGallon Car Mileage ∼ weight with(mtcars, plot(x=wt, y=mpg, xlab="...", ylab="...", pch=19, col="darkblue") ) identify(), locator(), grid() Baan Bapat Data Visualization with R
    • Scatterplot – fitted lines Bivariate Continuous Vs Continuous q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 2 3 4 5 1015202530 Car Weight MilesPerGallon linear model lowess abline( lsfit(x=wt, y=mpg), col="red") lines( lowess(x=wt, y=mpg), col="green") Baan Bapat Data Visualization with R
    • Scatterplot – fitted lines Bivariate Continuous Vs Continuous q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 2 3 4 5 1015202530 Car Weight MilesPerGallon linear model lowess abline( lsfit(x=wt, y=mpg), col="red") lines( lowess(x=wt, y=mpg), col="green") Baan Bapat Data Visualization with R
    • car::scatterplot Bivariate Continuous Vs Continuous qq 2 3 4 5 1015202530 Car Weight MilesperGallon q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q require(car) scatterplot(mpg ∼ wt, data=mtcars) Baan Bapat Data Visualization with R
    • car::scatterplot Bivariate Continuous Vs Continuous qq 2 3 4 5 1015202530 Car Weight MilesperGallon q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q require(car) scatterplot(mpg ∼ wt, data=mtcars) Baan Bapat Data Visualization with R
    • Bivariate boxplot – bagplot Bivariate Continuous Vs Continuous 2 3 4 5 1015202530 Car Weight MilesPerGallon q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q require(aplpack) bagplot(wt, mpg, ...) Baan Bapat Data Visualization with R
    • Bivariate boxplot – bagplot Bivariate Continuous Vs Continuous 2 3 4 5 1015202530 Car Weight MilesPerGallon q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q require(aplpack) bagplot(wt, mpg, ...) Baan Bapat Data Visualization with R
    • Lots of data points Bivariate Continuous Vs Continuous 4 6 8 10 12 14 16 101520 Alpha transparency x y rgb(0.2, 0.2, 0.8, 0.2) plot(..., col = rgb(0, 0.4, 0, 0.2)) Baan Bapat Data Visualization with R
    • Lots of data points – hexbin Bivariate Continuous Vs Continuous 4 6 8 10 12 14 16 10 15 20 x y Hexagonal Binning 1 6 10 14 19 24 28 32 37 42 46 50 55 60 64 68 73 Counts require(hexbin) bin <- hexbin(x, y, xbins=50) plot(bin, colramp=BTY, colorcut= seq(0,1,1/16)) Baan Bapat Data Visualization with R
    • Lots of data points – hexbin Bivariate Continuous Vs Continuous 4 6 8 10 12 14 16 10 15 20 x y Hexagonal Binning 1 6 10 14 19 24 28 32 37 42 46 50 55 60 64 68 73 Counts require(hexbin) bin <- hexbin(x, y, xbins=50) plot(bin, colramp=BTY, colorcut= seq(0,1,1/16)) Baan Bapat Data Visualization with R
    • Lots of data points – hexbin Bivariate Continuous Vs Continuous 4 6 8 10 12 14 16 10 15 20 x y Hexagonal Binning 1 6 10 14 19 24 28 32 37 42 46 50 55 60 64 68 73 Counts require(hexbin) bin <- hexbin(x, y, xbins=50) plot(bin, colramp=BTY, colorcut= seq(0,1,1/16)) Baan Bapat Data Visualization with R
    • Timeseries object Bivariate: Continuous Vs Time q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q qq q q q q q q q q q qq q q q q q q q q q q qq q q q q qqq q q q q q q q q qq q q q qq q q q q q q q qq q q q qq q q q q qq Time Temperature(degC) 1990 1992 1994 1996 1998 2000 242526272829 4 5 4 4 4 4 4 6 3 3 Sea surface temperature – El Ni˜no require(tseries) tt <- window(nino3, from=..., to=...) plot(tt) identify(...) text(...) Baan Bapat Data Visualization with R
    • Timeseries object Bivariate: Continuous Vs Time q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q qq q q q q q q q q q qq q q q q q q q q q q qq q q q q qqq q q q q q q q q qq q q q qq q q q q q q q qq q q q qq q q q q qq Time Temperature(degC) 1990 1992 1994 1996 1998 2000 242526272829 4 5 4 4 4 4 4 6 3 3 Sea surface temperature – El Ni˜no require(tseries) tt <- window(nino3, from=..., to=...) plot(tt) identify(...) text(...) Baan Bapat Data Visualization with R
    • Timeseries object Bivariate: Continuous Vs Time q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q qq q q q q q q q q q qq q q q q q q q q q q qq q q q q qqq q q q q q q q q qq q q q qq q q q q q q q qq q q q qq q q q q qq Time Temperature(degC) 1990 1992 1994 1996 1998 2000 242526272829 4 5 4 4 4 4 4 6 3 3 Sea surface temperature – El Ni˜no require(tseries) tt <- window(nino3, from=..., to=...) plot(tt) identify(...) text(...) Baan Bapat Data Visualization with R
    • Timeseries object Bivariate: Continuous Vs Time q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q qq q q q q q q q q q qq q q q q q q q q q q qq q q q q qqq q q q q q q q q qq q q q qq q q q q q q q qq q q q qq q q q q qq Time Temperature(degC) 1990 1992 1994 1996 1998 2000 242526272829 4 5 4 4 4 4 4 6 3 3 Sea surface temperature – El Ni˜no require(tseries) tt <- window(nino3, from=..., to=...) plot(tt) identify(...) text(...) Baan Bapat Data Visualization with R
    • Timeseries object Bivariate: Continuous Vs Time q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q qq q q q q q q q q q qq q q q q q q q q q q qq q q q q qqq q q q q q q q q qq q q q qq q q q q q q q qq q q q qq q q q q qq Time Temperature(degC) 1990 1992 1994 1996 1998 2000 242526272829 4 5 4 4 4 4 4 6 3 3 Sea surface temperature – El Ni˜no require(tseries) tt <- window(nino3, from=..., to=...) plot(tt) identify(...) text(...) Baan Bapat Data Visualization with R
    • Timeseries object Bivariate: Continuous Vs Time q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q qq q q q q q q q q q qq q q q q q q q q q q qq q q q q qqq q q q q q q q q qq q q q qq q q q q q q q qq q q q qq q q q q qq Time Temperature(degC) 1990 1992 1994 1996 1998 2000 242526272829 4 5 4 4 4 4 4 6 3 3 Sea surface temperature – El Ni˜no require(tseries) tt <- window(nino3, from=..., to=...) plot(tt) identify(...) text(...) Baan Bapat Data Visualization with R
    • The plot method Appropriately plots the object passed to it! Timeseries – decomposition nino3: Sea surface temperature of El Ni˜no plot(decompose(nino3)) 23252729 observed 25262728 trend −1.00.01.0 seasonal −1.00.00.51.0 1950 1960 1970 1980 1990 2000 random Time Decomposition of additive time series Baan Bapat Data Visualization with R
    • The plot method Appropriately plots the object passed to it! Multivariate data iris: flower measurements of 3 species which of the 3 species does a given flower belong to? plot(iris, col=iris$Species) Sepal.Length 2.0 3.0 4.0 q q qq q q q q q q q qq q q q q q q q q q q q q q q qq qq q q q qq q q q qq q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q qq q q q q q q qqq q q q q qq q q q q q q q q q q q q q qq q q q qq qq q q q q q q q q q q q q q qq q q qq q q q q q qqq q q q q q q qq q q q q q q q qq q qq q q q q q q q q q qq qq qq q q q qq q q q qq qq qq q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q qq q q qq q q q q q q qq q q q q qqq q q q q q q q q q q q q q qq q qq qq qq q q q q q q q qq q q q q qq q q qq q q q q q qqq q q q q 0.5 1.5 2.5 q q qq q q q q q q q qq q q q q q q q q q q q q q q qq qq q q q qq q q q qq qq qq q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q qq q q q q q q qqq q q q qqq q q q q q q q q q q q q q qq q q q qq qq q q q q q q q qq q q q q qq q q qq q q q q q q qq q q q q 4.55.56.57.5 q q qq q q q q q q q qq q qq q q q q q q q q q qq qq qq q q q qq q q q qq qq qq q q q q q q q q q q q q q q q q qqq q q q q q q q q q q q q qq q q qq q q q q q q qqq q q q qqq q q q q q q q q q q q q q qq q qq qq qq q q q q q q q qq q q q q qq q q qq q q q q q qqq q q q q 2.03.04.0 q q q q q q q q q q q q qq q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q qq q q q q q q q qq q q q q q q q q q q q q q q q qq qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q qqq q q q q q q q q Sepal.Width q q q q q q qq q q q q qq q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q qq q q q q q q q qq q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q qqq q q q q q q q q q q q q q q qq q q q q qq q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q qq q q q q q q q qq q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q qq q q q q q q qq q q q q q q q q q q q q q q q qq q q q q q q q q q qq q q q q q q qq q q q q q q q q q q q q q q qq q q q q qq q q q q qq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qq q q qq q q q q q q q qq q q q q q q q q q q q q q q q qq qq q q q q q q q q q q q q qq q q q q q q qq q q q q q q q q q q q q q q q qq q q q q q q q q q qq q q q q q qqq q q q q q q q q qqqq q q q qq q qqq q q qqq qq qq q qq qqqqqq qq qq q qqq qqqq q q q qq qq qq q q qq q q q q q qq q q qq q q q q q qq qq qq q q qq q q q q q q qq q q q q qqq q q q q q q qq q q q q q qq q qq qq qq q q q q q q q qq q q q q q q q q qq q qq qq qq qqqq q qq qq q q qqq q qqq q q qqq qqq q q qq q qqqqq q qqq q qqq qqq q q q q qq qq qq q q qq q q q q q qq q q qq q q q q q q q qq q q q q qq q q q qq q qq q q q q q qqq q q q q q qq q q q q q qq q q q qq qq q q q q q q q q q q q q q q q q q qq q qq qq qq qq q q q Petal.Length qqqqq q qqqqqqq qq qqq qqq q q qq q qqqqq qqqq qqqqqqqq q q qqqqq qq q q qq q q q q q qq q q qq q q q q q qq qq q q q q qq q q qqq q qq q q q q qqqq q q q q q q q q q q q q qq q q qqq qq q q q q q q q qq qq q q q q q q qq q q q qq q q qqq q q 1234567 qqqqq q qqqqqqq qq qqq qqqq q qq qqqqqqqqqq qqqqqqqq q q qqqqq qq q q qqq q q q q qq q q qq q q q q q qq qq qq q q qqq q qqq q qq qq q q qqqq q q q q q qq q q q q q qqq qqqq qq q q q q q q q qq qq q q q q q q qq q qq qq qq qqqq q 0.51.52.5 qqqq q q q qq q qq qq q qq q qq q q q q qq q qqqq q q qqq q q q q qq q q q q qq qq q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q qqq q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q q q q q q qqq q q q q q q q q q qq q q q q q q q q q q q qq qq q q q qq q qq qq q qq q qq q q q q qq q qqqq q q qqq q q q q qq q q q q qq qq q qq q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q q qq q q q q q q qq q q q q q q q q q qq q q q q q q q q q q q q qq q q qq q q q q q q q q q q qq q q q q q q q q q q q qqqqq q q qq q qq qq q qq qqq q q q q qq q qqqq q q qqqq q qq qq q q q q qqqq q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q qqq q q q q q q qq q q q q q q q q q qq q q q q q q q q q q q q q q q q qqq q q q q q q q q q qq q q q q q q q q q q q Petal.Width qqqqq q q qq q qq qq q qq qqq q q q q qq q qqqq q q qqqq q qq qq q q q q qqqq q qq q q q q q q q q q q q q q q q q q q q q q q qq q q q q q q q q q q qqq q q q q q q qq q q q q q q q q q qq q q q q q q q q q q q q qq q q qqq q q q q q q q q q qq q q q q q q q q q q q 4.5 5.5 6.5 7.5 qqqq q qq qq q qqqq qqqq qq qqq qqqqqqqq qq qqq qqq qqqq qqq qq qq qq qq qq qq qqq qqqq qqq qq qqqq qqqqqqqq qqq q qqqqq qqq qqq qq q qq qqq qq qq qqq qqq qq qqq qq qq q qqq q qq qqqq qqqq qqqq qqqqqqq qq qq q qqqq q qqqq q qqq qqq qqqqq qqqqq q qqqq qqq qqq q q qq qq qq qqqq qq qq qqq qq qq qqqq q qqq qqqq qqqqq qq q qqq qqq qqq q qqqq q qq qqqqq qq qqq qq q qq qqq qqqq qqq qq qq qqqq q qqqqqqq qqqq q qq 1 2 3 4 5 6 7 qqqqqqqqqqqqqqqqqqqqqqq qqqqqqqqqqqqqqqqqqqqqqqqqqq qq qq qqqq qqq qq qq qqq qq qq qqqq qqqqqqq qqqqqqq qqqq qqqqq q qq qqq qq qqqqqqqqqq qqq qq qq qqqq qqqqqq q qqqq qqqq qqqqqqq qqqqq qqqqqqqqqq qqqqqq qq qqq qqqqq qqqqqqqqqqqq qqqqqqq qqqq qq qq qqq qq qqqqq qq qq qqqqq qqqqq q qqqqqqqq qqq qqqqq q qq qq qqqqq qqq qq qqq qqq qqqq qqqq qq qq qqq qqqq q qqq q qqqq qq 1.0 2.0 3.0 1.02.03.0 Species Baan Bapat Data Visualization with R
    • The plot method Appropriately plots the object passed to it! Linear model of “Mileage ∼ Car Weight” lm1 <- lm(mpg ∼ wt, data=mtcars) par(mfrow=c(2,2)); plot(lm1) 10 15 20 25 30 −4−202468 Fitted values Residuals q q q q q q q q q q q q q q q q q q q q q q qq q qq q q q q q Residuals vs Fitted Fiat 128 Toyota Corolla Chrysler Imperial q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q −2 −1 0 1 2 −1012 Theoretical Quantiles Standardizedresiduals Normal Q−Q Fiat 128 Toyota CorollaChrysler Imperial 10 15 20 25 30 0.00.51.01.5 Fitted values Standardizedresiduals q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q Scale−Location Fiat 128Toyota CorollaChrysler Imperial 0.00 0.05 0.10 0.15 0.20 −2−1012 Leverage Standardizedresiduals q q q q q q q q q q q q q q q q q q q q q q q q q qq q q q q q Cook's distance 0.5 0.5 1 Residuals vs Leverage Chrysler ImperialToyota CorollaFiat 128 Baan Bapat Data Visualization with R
    • The plot method Appropriately plots the object passed to it! Cluster cars based on their attributes hc <- hclust(dist(mtcars)) plot(hc); rect.hclust(hc, k=4) MaseratiBora ChryslerImperial CadillacFleetwood LincolnContinental FordPanteraL Duster360 CamaroZ28 HornetSportabout PontiacFirebird Hornet4Drive Valiant Merc450SLC Merc450SE Merc450SL DodgeChallenger AMCJavelin HondaCivic ToyotaCorolla Fiat128 FiatX1−9 FerrariDino LotusEuropa Merc230 Volvo142E Datsun710 ToyotaCorona Porsche914−2 Merc240D MazdaRX4 MazdaRX4Wag Merc280 Merc280C 0100200300400 Cluster Dendrogram hclust (*, "complete") dist(mtcars) Height Baan Bapat Data Visualization with R
    • The plot method Appropriately plots the object passed to it! Decision tree: Given Mileage, how many cylinders does the car have? require(rpart); require(rpart.plot) rp1 <- rpart(factor(cyl) ∼ mpg, data=mtcars) prp(rp1) mpg >= 21 mpg >= 184 6 8 yes no Baan Bapat Data Visualization with R
    • Financial timeseries Multivariate: Continuous Vs Time 23 24 25 26 27 YHOO [2013−04−01/2013−06−20] Last 25.35 Volume (millions): 18,811,400 10 20 30 40 Apr 01 2013 Apr 15 2013 Apr 29 2013 May 13 2013 May 28 2013 Jun 10 2013 Jun 20 2013 OLHC data of stock price require(quantmod) getSymbols( "YHOO", from="2013-04-01") chartSeries(YHOO) Baan Bapat Data Visualization with R
    • Financial timeseries Multivariate: Continuous Vs Time 23 24 25 26 27 YHOO [2013−04−01/2013−06−20] Last 25.35 Volume (millions): 18,811,400 10 20 30 40 Apr 01 2013 Apr 15 2013 Apr 29 2013 May 13 2013 May 28 2013 Jun 10 2013 Jun 20 2013 OLHC data of stock price require(quantmod) getSymbols( "YHOO", from="2013-04-01") chartSeries(YHOO) Baan Bapat Data Visualization with R
    • Financial timeseries Multivariate: Continuous Vs Time 23 24 25 26 27 YHOO [2013−04−01/2013−06−20] Last 25.35 Volume (millions): 18,811,400 10 20 30 40 Apr 01 2013 Apr 15 2013 Apr 29 2013 May 13 2013 May 28 2013 Jun 10 2013 Jun 20 2013 OLHC data of stock price require(quantmod) getSymbols( "YHOO", from="2013-04-01") chartSeries(YHOO) Baan Bapat Data Visualization with R
    • Financial timeseries Multivariate: Continuous Vs Time 23 24 25 26 27 YHOO [2013−04−01/2013−06−20] Last 25.35 Volume (millions): 18,811,400 10 20 30 40 Apr 01 2013 Apr 15 2013 Apr 29 2013 May 13 2013 May 28 2013 Jun 10 2013 Jun 20 2013 OLHC data of stock price require(quantmod) getSymbols( "YHOO", from="2013-04-01") chartSeries(YHOO) Baan Bapat Data Visualization with R
    • Complex data plotting Multivariate data, mixed modes lattice: based on the idea of conditioning on the values taken on by one or more of the variables in a data set. xyplot levelplot panel functions ggplot2: implementation of the grammar of graphics in R. data aesthetics geometry statistical operation scales facets coordinates options Baan Bapat Data Visualization with R
    • Complex data plotting Multivariate data, mixed modes lattice: based on the idea of conditioning on the values taken on by one or more of the variables in a data set. xyplot levelplot panel functions ggplot2: implementation of the grammar of graphics in R. data aesthetics geometry statistical operation scales facets coordinates options Baan Bapat Data Visualization with R
    • Complex data plotting Multivariate data, mixed modes lattice: based on the idea of conditioning on the values taken on by one or more of the variables in a data set. xyplot levelplot panel functions ggplot2: implementation of the grammar of graphics in R. data aesthetics geometry statistical operation scales facets coordinates options Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Continuous, by categorical Mileage Price 20000 40000 60000 0 20000 50000 qqqqqqqqq qq qqqqqqqq q 9_3 q qqqqqqqqqqqqqqqqqqq qqqqqqqqq qqq qqq qqqq q 9_3 HO 0 20000 50000 q qqq qqqqq q qqqqqqqqqq q qqqqqqq qq 9_5 q qqqqqqqq q qqqqqqqqq q 9_5 HO 0 20000 50000 q qqq 9−2X AWD qq qqqqqqqqqq qqqqqq q qqqqqqqqqqqqqqqqqqqq qqqq qqqqqq qq qqqqqqq qq AVEO qqqqqqqqqqqqqqqqqqqq qqqqqqqqqq Bonneville q qqqqqqqqqq q qqqqqqqqq qqqq qqq qqqqq qqqqqq qqq qqqqqqq qq qqqqqqqq q Cavalier qqqqqqqqqq Century qqqqqqqq qq Classic q qqqqqqqqqqq qqqqqqqqqqqqqqqqq qq qqqqqqqqqqqqq qqqqqq Cobalt 20000 40000 60000 qq qqqqqqqqqqqqq qqqq q Corvette 20000 40000 60000 qq q qqqqqqq CST−V qqqqqqqqq q CTS qqqqqqqqqq qqqq qqqq q qqqqqqqqqqq Deville qqqqq qqqqqqqq qqqqqq q G6 qqqqq qqqqqqqqqq qq qqq Grand Am qqqqqqqqqq qqqqqqqqqqqq qqqqqqqq Grand Prix qqqqqqqqq q GTO q qqqqqqqqqq q qqqqqqqq qq qq qqqqq q Impala q qqqqqqqqqqqqqqqqqq qqq qqqqqqqqqqqqqqqqqqqqqqqqqqqq Ion qqqqqqqqq q L Series qqqqqqqq qq qqqqqqqqqqqqqqqqqqqq Lacrosse 20000 40000 60000 q q qqqqqqqqqqqqqqqqqq Lesabre 20000 40000 60000 qq qqqqqqq qq q q qqqqqqqq qqqqqqqqqq qqqqqqqqqqqq qqqqqqqqqqqqqqqqq Malibu qqqqqqqqq q q qqqqqqqq q qq qqqqqqqq Monte Carlo q q qqqqqqqq qqqqqq qqq q Park Avenue qq qqqqqqq q STS−V6 qq qqqqqqqq STS−V8 qqqqqqqqqq Sunfire qqqqqqqqqqqqqqqqq qqqqqqqqq qqqq Vibe 0 20000 50000 20000 40000 60000 q qqqqqq qq q XLR−V8 Car resale price as a function of mileage and model require(lattice) xyplot(Price ∼ Mileage | Model, data=ca) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Continuous, by categorical Mileage Price 20000 40000 60000 0 20000 50000 qqqqqqqqq qq qqqqqqqq q 9_3 q qqqqqqqqqqqqqqqqqqq qqqqqqqqq qqq qqq qqqq q 9_3 HO 0 20000 50000 q qqq qqqqq q qqqqqqqqqq q qqqqqqq qq 9_5 q qqqqqqqq q qqqqqqqqq q 9_5 HO 0 20000 50000 q qqq 9−2X AWD qq qqqqqqqqqq qqqqqq q qqqqqqqqqqqqqqqqqqqq qqqq qqqqqq qq qqqqqqq qq AVEO qqqqqqqqqqqqqqqqqqqq qqqqqqqqqq Bonneville q qqqqqqqqqq q qqqqqqqqq qqqq qqq qqqqq qqqqqq qqq qqqqqqq qq qqqqqqqq q Cavalier qqqqqqqqqq Century qqqqqqqq qq Classic q qqqqqqqqqqq qqqqqqqqqqqqqqqqq qq qqqqqqqqqqqqq qqqqqq Cobalt 20000 40000 60000 qq qqqqqqqqqqqqq qqqq q Corvette 20000 40000 60000 qq q qqqqqqq CST−V qqqqqqqqq q CTS qqqqqqqqqq qqqq qqqq q qqqqqqqqqqq Deville qqqqq qqqqqqqq qqqqqq q G6 qqqqq qqqqqqqqqq qq qqq Grand Am qqqqqqqqqq qqqqqqqqqqqq qqqqqqqq Grand Prix qqqqqqqqq q GTO q qqqqqqqqqq q qqqqqqqq qq qq qqqqq q Impala q qqqqqqqqqqqqqqqqqq qqq qqqqqqqqqqqqqqqqqqqqqqqqqqqq Ion qqqqqqqqq q L Series qqqqqqqq qq qqqqqqqqqqqqqqqqqqqq Lacrosse 20000 40000 60000 q q qqqqqqqqqqqqqqqqqq Lesabre 20000 40000 60000 qq qqqqqqq qq q q qqqqqqqq qqqqqqqqqq qqqqqqqqqqqq qqqqqqqqqqqqqqqqq Malibu qqqqqqqqq q q qqqqqqqq q qq qqqqqqqq Monte Carlo q q qqqqqqqq qqqqqq qqq q Park Avenue qq qqqqqqq q STS−V6 qq qqqqqqqq STS−V8 qqqqqqqqqq Sunfire qqqqqqqqqqqqqqqqq qqqqqqqqq qqqq Vibe 0 20000 50000 20000 40000 60000 q qqqqqq qq q XLR−V8 Car resale price as a function of mileage and model require(lattice) xyplot(Price ∼ Mileage | Model, data=ca) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Continuous, by categorical Mileage Price 20000 40000 60000 0 20000 50000 qqqqqqqqq qq qqqqqqqq q 9_3 q qqqqqqqqqqqqqqqqqqq qqqqqqqqq qqq qqq qqqq q 9_3 HO 0 20000 50000 q qqq qqqqq q qqqqqqqqqq q qqqqqqq qq 9_5 q qqqqqqqq q qqqqqqqqq q 9_5 HO 0 20000 50000 q qqq 9−2X AWD qq qqqqqqqqqq qqqqqq q qqqqqqqqqqqqqqqqqqqq qqqq qqqqqq qq qqqqqqq qq AVEO qqqqqqqqqqqqqqqqqqqq qqqqqqqqqq Bonneville q qqqqqqqqqq q qqqqqqqqq qqqq qqq qqqqq qqqqqq qqq qqqqqqq qq qqqqqqqq q Cavalier qqqqqqqqqq Century qqqqqqqq qq Classic q qqqqqqqqqqq qqqqqqqqqqqqqqqqq qq qqqqqqqqqqqqq qqqqqq Cobalt 20000 40000 60000 qq qqqqqqqqqqqqq qqqq q Corvette 20000 40000 60000 qq q qqqqqqq CST−V qqqqqqqqq q CTS qqqqqqqqqq qqqq qqqq q qqqqqqqqqqq Deville qqqqq qqqqqqqq qqqqqq q G6 qqqqq qqqqqqqqqq qq qqq Grand Am qqqqqqqqqq qqqqqqqqqqqq qqqqqqqq Grand Prix qqqqqqqqq q GTO q qqqqqqqqqq q qqqqqqqq qq qq qqqqq q Impala q qqqqqqqqqqqqqqqqqq qqq qqqqqqqqqqqqqqqqqqqqqqqqqqqq Ion qqqqqqqqq q L Series qqqqqqqq qq qqqqqqqqqqqqqqqqqqqq Lacrosse 20000 40000 60000 q q qqqqqqqqqqqqqqqqqq Lesabre 20000 40000 60000 qq qqqqqqq qq q q qqqqqqqq qqqqqqqqqq qqqqqqqqqqqq qqqqqqqqqqqqqqqqq Malibu qqqqqqqqq q q qqqqqqqq q qq qqqqqqqq Monte Carlo q q qqqqqqqq qqqqqq qqq q Park Avenue qq qqqqqqq q STS−V6 qq qqqqqqqq STS−V8 qqqqqqqqqq Sunfire qqqqqqqqqqqqqqqqq qqqqqqqqq qqqq Vibe 0 20000 50000 20000 40000 60000 q qqqqqq qq q XLR−V8 Car resale price as a function of mileage and model require(lattice) xyplot(Price ∼ Mileage | Model, data=ca) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Continuous, by categorical Mileage Price 20000 40000 60000 0 20000 50000 qqqqqqqqq qq qqqqqqqq q 9_3 q qqqqqqqqqqqqqqqqqqq qqqqqqqqq qqq qqq qqqq q 9_3 HO 0 20000 50000 q qqq qqqqq q qqqqqqqqqq q qqqqqqq qq 9_5 q qqqqqqqq q qqqqqqqqq q 9_5 HO 0 20000 50000 q qqq 9−2X AWD qq qqqqqqqqqq qqqqqq q qqqqqqqqqqqqqqqqqqqq qqqq qqqqqq qq qqqqqqq qq AVEO qqqqqqqqqqqqqqqqqqqq qqqqqqqqqq Bonneville q qqqqqqqqqq q qqqqqqqqq qqqq qqq qqqqq qqqqqq qqq qqqqqqq qq qqqqqqqq q Cavalier qqqqqqqqqq Century qqqqqqqq qq Classic q qqqqqqqqqqq qqqqqqqqqqqqqqqqq qq qqqqqqqqqqqqq qqqqqq Cobalt 20000 40000 60000 qq qqqqqqqqqqqqq qqqq q Corvette 20000 40000 60000 qq q qqqqqqq CST−V qqqqqqqqq q CTS qqqqqqqqqq qqqq qqqq q qqqqqqqqqqq Deville qqqqq qqqqqqqq qqqqqq q G6 qqqqq qqqqqqqqqq qq qqq Grand Am qqqqqqqqqq qqqqqqqqqqqq qqqqqqqq Grand Prix qqqqqqqqq q GTO q qqqqqqqqqq q qqqqqqqq qq qq qqqqq q Impala q qqqqqqqqqqqqqqqqqq qqq qqqqqqqqqqqqqqqqqqqqqqqqqqqq Ion qqqqqqqqq q L Series qqqqqqqq qq qqqqqqqqqqqqqqqqqqqq Lacrosse 20000 40000 60000 q q qqqqqqqqqqqqqqqqqq Lesabre 20000 40000 60000 qq qqqqqqq qq q q qqqqqqqq qqqqqqqqqq qqqqqqqqqqqq qqqqqqqqqqqqqqqqq Malibu qqqqqqqqq q q qqqqqqqq q qq qqqqqqqq Monte Carlo q q qqqqqqqq qqqqqq qqq q Park Avenue qq qqqqqqq q STS−V6 qq qqqqqqqq STS−V8 qqqqqqqqqq Sunfire qqqqqqqqqqqqqqqqq qqqqqqqqq qqqq Vibe 0 20000 50000 20000 40000 60000 q qqqqqq qq q XLR−V8 xyplot(Price ∼ Mileage | Model, data=ca, panel = function(x, y){ panel.xyplot(x, y) panel.lmline(x, y, span=1, col="red")}) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Continuous, by categorical Mileage Price 20000 40000 60000 0 20000 50000 qqqqqqqqq qq qqqqqqqq q 9_3 q qqqqqqqqqqqqqqqqqqq qqqqqqqqq qqq qqq qqqq q 9_3 HO 0 20000 50000 q qqq qqqqq q qqqqqqqqqq q qqqqqqq qq 9_5 q qqqqqqqq q qqqqqqqqq q 9_5 HO 0 20000 50000 q qqq 9−2X AWD qq qqqqqqqqqq qqqqqq q qqqqqqqqqqqqqqqqqqqq qqqq qqqqqq qq qqqqqqq qq AVEO qqqqqqqqqqqqqqqqqqqq qqqqqqqqqq Bonneville q qqqqqqqqqq q qqqqqqqqq qqqq qqq qqqqq qqqqqq qqq qqqqqqq qq qqqqqqqq q Cavalier qqqqqqqqqq Century qqqqqqqq qq Classic q qqqqqqqqqqq qqqqqqqqqqqqqqqqq qq qqqqqqqqqqqqq qqqqqq Cobalt 20000 40000 60000 qq qqqqqqqqqqqqq qqqq q Corvette 20000 40000 60000 qq q qqqqqqq CST−V qqqqqqqqq q CTS qqqqqqqqqq qqqq qqqq q qqqqqqqqqqq Deville qqqqq qqqqqqqq qqqqqq q G6 qqqqq qqqqqqqqqq qq qqq Grand Am qqqqqqqqqq qqqqqqqqqqqq qqqqqqqq Grand Prix qqqqqqqqq q GTO q qqqqqqqqqq q qqqqqqqq qq qq qqqqq q Impala q qqqqqqqqqqqqqqqqqq qqq qqqqqqqqqqqqqqqqqqqqqqqqqqqq Ion qqqqqqqqq q L Series qqqqqqqq qq qqqqqqqqqqqqqqqqqqqq Lacrosse 20000 40000 60000 q q qqqqqqqqqqqqqqqqqq Lesabre 20000 40000 60000 qq qqqqqqq qq q q qqqqqqqq qqqqqqqqqq qqqqqqqqqqqq qqqqqqqqqqqqqqqqq Malibu qqqqqqqqq q q qqqqqqqq q qq qqqqqqqq Monte Carlo q q qqqqqqqq qqqqqq qqq q Park Avenue qq qqqqqqq q STS−V6 qq qqqqqqqq STS−V8 qqqqqqqqqq Sunfire qqqqqqqqqqqqqqqqq qqqqqqqqq qqqq Vibe 0 20000 50000 20000 40000 60000 q qqqqqq qq q XLR−V8 xyplot(Price ∼ Mileage | Model, data=ca, panel = function(x, y){ panel.xyplot(x, y) panel.lmline(x, y, span=1, col="red")}) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Continuous, by categorical Mileage Price 20000 40000 60000 0 20000 50000 qqqqqqqqq qq qqqqqqqq q 9_3 q qqqqqqqqqqqqqqqqqqq qqqqqqqqq qqq qqq qqqq q 9_3 HO 0 20000 50000 q qqq qqqqq q qqqqqqqqqq q qqqqqqq qq 9_5 q qqqqqqqq q qqqqqqqqq q 9_5 HO 0 20000 50000 q qqq 9−2X AWD qq qqqqqqqqqq qqqqqq q qqqqqqqqqqqqqqqqqqqq qqqq qqqqqq qq qqqqqqq qq AVEO qqqqqqqqqqqqqqqqqqqq qqqqqqqqqq Bonneville q qqqqqqqqqq q qqqqqqqqq qqqq qqq qqqqq qqqqqq qqq qqqqqqq qq qqqqqqqq q Cavalier qqqqqqqqqq Century qqqqqqqq qq Classic q qqqqqqqqqqq qqqqqqqqqqqqqqqqq qq qqqqqqqqqqqqq qqqqqq Cobalt 20000 40000 60000 qq qqqqqqqqqqqqq qqqq q Corvette 20000 40000 60000 qq q qqqqqqq CST−V qqqqqqqqq q CTS qqqqqqqqqq qqqq qqqq q qqqqqqqqqqq Deville qqqqq qqqqqqqq qqqqqq q G6 qqqqq qqqqqqqqqq qq qqq Grand Am qqqqqqqqqq qqqqqqqqqqqq qqqqqqqq Grand Prix qqqqqqqqq q GTO q qqqqqqqqqq q qqqqqqqq qq qq qqqqq q Impala q qqqqqqqqqqqqqqqqqq qqq qqqqqqqqqqqqqqqqqqqqqqqqqqqq Ion qqqqqqqqq q L Series qqqqqqqq qq qqqqqqqqqqqqqqqqqqqq Lacrosse 20000 40000 60000 q q qqqqqqqqqqqqqqqqqq Lesabre 20000 40000 60000 qq qqqqqqq qq q q qqqqqqqq qqqqqqqqqq qqqqqqqqqqqq qqqqqqqqqqqqqqqqq Malibu qqqqqqqqq q q qqqqqqqq q qq qqqqqqqq Monte Carlo q q qqqqqqqq qqqqqq qqq q Park Avenue qq qqqqqqq q STS−V6 qq qqqqqqqq STS−V8 qqqqqqqqqq Sunfire qqqqqqqqqqqqqqqqq qqqqqqqqq qqqq Vibe 0 20000 50000 20000 40000 60000 q qqqqqq qq q XLR−V8 xyplot(Price ∼ Mileage | Model, data=ca, panel = function(x, y){ panel.xyplot(x, y) panel.lmline(x, y, span=1, col="red")}) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Continuous, by categorical Mileage Price 20000 40000 60000 0 20000 50000 qqqqqqqqq qq qqqqqqqq q 9_3 q qqqqqqqqqqqqqqqqqqq qqqqqqqqq qqq qqq qqqq q 9_3 HO 0 20000 50000 q qqq qqqqq q qqqqqqqqqq q qqqqqqq qq 9_5 q qqqqqqqq q qqqqqqqqq q 9_5 HO 0 20000 50000 q qqq 9−2X AWD qq qqqqqqqqqq qqqqqq q qqqqqqqqqqqqqqqqqqqq qqqq qqqqqq qq qqqqqqq qq AVEO qqqqqqqqqqqqqqqqqqqq qqqqqqqqqq Bonneville q qqqqqqqqqq q qqqqqqqqq qqqq qqq qqqqq qqqqqq qqq qqqqqqq qq qqqqqqqq q Cavalier qqqqqqqqqq Century qqqqqqqq qq Classic q qqqqqqqqqqq qqqqqqqqqqqqqqqqq qq qqqqqqqqqqqqq qqqqqq Cobalt 20000 40000 60000 qq qqqqqqqqqqqqq qqqq q Corvette 20000 40000 60000 qq q qqqqqqq CST−V qqqqqqqqq q CTS qqqqqqqqqq qqqq qqqq q qqqqqqqqqqq Deville qqqqq qqqqqqqq qqqqqq q G6 qqqqq qqqqqqqqqq qq qqq Grand Am qqqqqqqqqq qqqqqqqqqqqq qqqqqqqq Grand Prix qqqqqqqqq q GTO q qqqqqqqqqq q qqqqqqqq qq qq qqqqq q Impala q qqqqqqqqqqqqqqqqqq qqq qqqqqqqqqqqqqqqqqqqqqqqqqqqq Ion qqqqqqqqq q L Series qqqqqqqq qq qqqqqqqqqqqqqqqqqqqq Lacrosse 20000 40000 60000 q q qqqqqqqqqqqqqqqqqq Lesabre 20000 40000 60000 qq qqqqqqq qq q q qqqqqqqq qqqqqqqqqq qqqqqqqqqqqq qqqqqqqqqqqqqqqqq Malibu qqqqqqqqq q q qqqqqqqq q qq qqqqqqqq Monte Carlo q q qqqqqqqq qqqqqq qqq q Park Avenue qq qqqqqqq q STS−V6 qq qqqqqqqq STS−V8 qqqqqqqqqq Sunfire qqqqqqqqqqqqqqqqq qqqqqqqqq qqqq Vibe 0 20000 50000 20000 40000 60000 q qqqqqq qq q XLR−V8 xyplot(Price ∼ Mileage | Model, data=ca, panel = function(x, y){ panel.xyplot(x, y) panel.lmline(x, y, span=1, col="red")}) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Continuous, by categorical Mileage Price 20000 40000 60000 0 20000 50000 qqqqqqqqq qq qqqqqqqq q 9_3 q qqqqqqqqqqqqqqqqqqq qqqqqqqqq qqq qqq qqqq q 9_3 HO 0 20000 50000 q qqq qqqqq q qqqqqqqqqq q qqqqqqq qq 9_5 q qqqqqqqq q qqqqqqqqq q 9_5 HO 0 20000 50000 q qqq 9−2X AWD qq qqqqqqqqqq qqqqqq q qqqqqqqqqqqqqqqqqqqq qqqq qqqqqq qq qqqqqqq qq AVEO qqqqqqqqqqqqqqqqqqqq qqqqqqqqqq Bonneville q qqqqqqqqqq q qqqqqqqqq qqqq qqq qqqqq qqqqqq qqq qqqqqqq qq qqqqqqqq q Cavalier qqqqqqqqqq Century qqqqqqqq qq Classic q qqqqqqqqqqq qqqqqqqqqqqqqqqqq qq qqqqqqqqqqqqq qqqqqq Cobalt 20000 40000 60000 qq qqqqqqqqqqqqq qqqq q Corvette 20000 40000 60000 qq q qqqqqqq CST−V qqqqqqqqq q CTS qqqqqqqqqq qqqq qqqq q qqqqqqqqqqq Deville qqqqq qqqqqqqq qqqqqq q G6 qqqqq qqqqqqqqqq qq qqq Grand Am qqqqqqqqqq qqqqqqqqqqqq qqqqqqqq Grand Prix qqqqqqqqq q GTO q qqqqqqqqqq q qqqqqqqq qq qq qqqqq q Impala q qqqqqqqqqqqqqqqqqq qqq qqqqqqqqqqqqqqqqqqqqqqqqqqqq Ion qqqqqqqqq q L Series qqqqqqqq qq qqqqqqqqqqqqqqqqqqqq Lacrosse 20000 40000 60000 q q qqqqqqqqqqqqqqqqqq Lesabre 20000 40000 60000 qq qqqqqqq qq q q qqqqqqqq qqqqqqqqqq qqqqqqqqqqqq qqqqqqqqqqqqqqqqq Malibu qqqqqqqqq q q qqqqqqqq q qq qqqqqqqq Monte Carlo q q qqqqqqqq qqqqqq qqq q Park Avenue qq qqqqqqq q STS−V6 qq qqqqqqqq STS−V8 qqqqqqqqqq Sunfire qqqqqqqqqqqqqqqqq qqqqqqqqq qqqq Vibe 0 20000 50000 20000 40000 60000 q qqqqqq qq q XLR−V8 xyplot(Price ∼ Mileage | Model, data=ca, panel = function(x, y){ panel.xyplot(x, y) panel.lmline(x, y, span=1, col="red")}) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Several Categorical variety BarleyYield(bushels/acre) 20 30 40 50 60 Svansota N o.462 M anchuria N o.475 Velvet Peatland G labron N o.457 W isconsin N o.38 Trebi q qq q qqq q q q Grand Rapids 20 30 40 50 60 q qq q q qq qq q Duluth 20 30 40 50 60 q q q q qqq qq q University Farm 20 30 40 50 60 q qq q qqq qq q Morris 20 30 40 50 60 q q q q q qq q q q Crookston 20 30 40 50 60 q qq q q qq q q q Waseca q 1931 1932 xyplot(yield ∼ variety | site, data = barley, groups = year, pch = c(21,22), layout = c(1,6), stack = TRUE, auto.key = list(space = "right"), ylab = "Barley Yield (bushels/acre)", scales = list(x = list(rot = 45))) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Several Categorical variety BarleyYield(bushels/acre) 20 30 40 50 60 Svansota N o.462 M anchuria N o.475 Velvet Peatland G labron N o.457 W isconsin N o.38 Trebi q qq q qqq q q q Grand Rapids 20 30 40 50 60 q qq q q qq qq q Duluth 20 30 40 50 60 q q q q qqq qq q University Farm 20 30 40 50 60 q qq q qqq qq q Morris 20 30 40 50 60 q q q q q qq q q q Crookston 20 30 40 50 60 q qq q q qq q q q Waseca q 1931 1932 xyplot(yield ∼ variety | site, data = barley, groups = year, pch = c(21,22), layout = c(1,6), stack = TRUE, auto.key = list(space = "right"), ylab = "Barley Yield (bushels/acre)", scales = list(x = list(rot = 45))) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Several Categorical variety BarleyYield(bushels/acre) 20 30 40 50 60 Svansota N o.462 M anchuria N o.475 Velvet Peatland G labron N o.457 W isconsin N o.38 Trebi q qq q qqq q q q Grand Rapids 20 30 40 50 60 q qq q q qq qq q Duluth 20 30 40 50 60 q q q q qqq qq q University Farm 20 30 40 50 60 q qq q qqq qq q Morris 20 30 40 50 60 q q q q q qq q q q Crookston 20 30 40 50 60 q qq q q qq q q q Waseca q 1931 1932 xyplot(yield ∼ variety | site, data = barley, groups = year, pch = c(21,22), layout = c(1,6), stack = TRUE, auto.key = list(space = "right"), ylab = "Barley Yield (bushels/acre)", scales = list(x = list(rot = 45))) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Several Categorical variety BarleyYield(bushels/acre) 20 30 40 50 60 Svansota N o.462 M anchuria N o.475 Velvet Peatland G labron N o.457 W isconsin N o.38 Trebi q qq q qqq q q q Grand Rapids 20 30 40 50 60 q qq q q qq qq q Duluth 20 30 40 50 60 q q q q qqq qq q University Farm 20 30 40 50 60 q qq q qqq qq q Morris 20 30 40 50 60 q q q q q qq q q q Crookston 20 30 40 50 60 q qq q q qq q q q Waseca q 1931 1932 xyplot(yield ∼ variety | site, data = barley, groups = year, pch = c(21,22), layout = c(1,6), stack = TRUE, auto.key = list(space = "right"), ylab = "Barley Yield (bushels/acre)", scales = list(x = list(rot = 45))) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Several Categorical variety BarleyYield(bushels/acre) 20 30 40 50 60 Svansota N o.462 M anchuria N o.475 Velvet Peatland G labron N o.457 W isconsin N o.38 Trebi q qq q qqq q q q Grand Rapids 20 30 40 50 60 q qq q q qq qq q Duluth 20 30 40 50 60 q q q q qqq qq q University Farm 20 30 40 50 60 q qq q qqq qq q Morris 20 30 40 50 60 q q q q q qq q q q Crookston 20 30 40 50 60 q qq q q qq q q q Waseca q 1931 1932 xyplot(yield ∼ variety | site, data = barley, groups = year, pch = c(21,22), layout = c(1,6), stack = TRUE, auto.key = list(space = "right"), ylab = "Barley Yield (bushels/acre)", scales = list(x = list(rot = 45))) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Several Categorical variety BarleyYield(bushels/acre) 20 30 40 50 60 Svansota N o.462 M anchuria N o.475 Velvet Peatland G labron N o.457 W isconsin N o.38 Trebi q qq q qqq q q q Grand Rapids 20 30 40 50 60 q qq q q qq qq q Duluth 20 30 40 50 60 q q q q qqq qq q University Farm 20 30 40 50 60 q qq q qqq qq q Morris 20 30 40 50 60 q q q q q qq q q q Crookston 20 30 40 50 60 q qq q q qq q q q Waseca q 1931 1932 xyplot(yield ∼ variety | site, data = barley, groups = year, pch = c(21,22), layout = c(1,6), stack = TRUE, auto.key = list(space = "right"), ylab = "Barley Yield (bushels/acre)", scales = list(x = list(rot = 45))) Baan Bapat Data Visualization with R
    • xyplot Multivariate: Continuous Vs Several Categorical variety BarleyYield(bushels/acre) 20 30 40 50 60 Svansota N o.462 M anchuria N o.475 Velvet Peatland G labron N o.457 W isconsin N o.38 Trebi q qq q qqq q q q Grand Rapids 20 30 40 50 60 q qq q q qq qq q Duluth 20 30 40 50 60 q q q q qqq qq q University Farm 20 30 40 50 60 q qq q qqq qq q Morris 20 30 40 50 60 q q q q q qq q q q Crookston 20 30 40 50 60 q qq q q qq q q q Waseca q 1931 1932 xyplot(yield ∼ variety | site, data = barley, groups = year, pch = c(21,22), layout = c(1,6), stack = TRUE, auto.key = list(space = "right"), ylab = "Barley Yield (bushels/acre)", scales = list(x = list(rot = 45))) Baan Bapat Data Visualization with R
    • ggplot qplot: iris Multivariate data iris: flower measurements of 3 species qplot( Sepal.Length, Petal.Length, data = iris, color = Species, size=Petal.Width, alpha=I(0.7)) 2 4 6 5 6 7 8 Sepal.Length Petal.Length Species setosa versicolor virginica log(Petal.Width) −2 −1 0 Baan Bapat Data Visualization with R
    • qplot several time series Growth of Orange trees qplot(age, circumference, data = Orange, geom = c("point", "line"), colour = Tree) q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q q 50 100 150 200 400 800 1200 1600 age circumference Tree q q q q q 3 1 5 2 4 Baan Bapat Data Visualization with R
    • qplot Diamond: price, caret & cut qplot(carat, price, data=diamonds, colour=cut, geom=c("point", "smooth")) defaults + layers + scales + coordinate system Layer = data + mapping + geom + stat + position Baan Bapat Data Visualization with R
    • qplot Diamond: price, caret & cut qplot(carat, price, data=diamonds, colour=cut, geom=c("point", "smooth")) defaults + layers + scales + coordinate system Layer = data + mapping + geom + stat + position Baan Bapat Data Visualization with R
    • qplot Diamond: price, caret & cut qplot(carat, price, data=diamonds, colour=cut, geom=c("point", "smooth")) defaults + layers + scales + coordinate system Layer = data + mapping + geom + stat + position Baan Bapat Data Visualization with R
    • Human Development and Corruption UNDP Corruption Perception and Human Development Data Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United States Australia Norway 0.4 0.6 0.8 1.0 2.5 5.0 7.5 Corruption Perception Index 2011 (10 = least) HumanDevelopmentIndex2011(1=best) Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA HDI Vs CPI Country Region Baan Bapat Data Visualization with R
    • Human Development and Corruption 0.4 0.6 0.8 2.5 5.0 7.5 CPI HDI Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA pc1 <- ggplot(dat, aes(x=CPI, y=HDI, color=Region)) pc1 <- pc1 + geom point(shape=9) Baan Bapat Data Visualization with R
    • Human Development and Corruption 0.4 0.6 0.8 2.5 5.0 7.5 CPI HDI Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA pc1 <- ggplot(dat, aes(x=CPI, y=HDI, color=Region)) pc1 <- pc1 + geom point(shape=9) Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United StatesAustralia Norway 0.4 0.6 0.8 2.5 5.0 7.5 CPI HDI Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA labs <- c("Chad",... pc2 <- pc1 + geom text(aes(label = Country), color="black", size=3, hjust=1.1, data= dat[dat$Country %in% labs,]) Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United StatesAustralia Norway 0.4 0.6 0.8 2.5 5.0 7.5 CPI HDI Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA labs <- c("Chad",... pc2 <- pc1 + geom text(aes(label = Country), color="black", size=3, hjust=1.1, data= dat[dat$Country %in% labs,]) Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United StatesAustralia Norway 0.4 0.6 0.8 2.5 5.0 7.5 CPI HDI Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA labs <- c("Chad",... pc2 <- pc1 + geom text(aes(label = Country), color="black", size=3, hjust=1.1, data= dat[dat$Country %in% labs,]) Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United StatesAustralia Norway 0.4 0.6 0.8 2.5 5.0 7.5 CPI HDI Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA labs <- c("Chad",... pc2 <- pc1 + geom text(aes(label = Country), color="black", size=3, hjust=1.1, data= dat[dat$Country %in% labs,]) Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United StatesAustralia Norway 0.4 0.6 0.8 2.5 5.0 7.5 CPI HDI Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA labs <- c("Chad",... pc2 <- pc1 + geom text(aes(label = Country), color="black", size=3, hjust=1.1, data= dat[dat$Country %in% labs,]) Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United StatesAustralia Norway 0.4 0.6 0.8 1.0 2.5 5.0 7.5 CPI HDI Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA pc3 <- pc2 + geom smooth( method="lm", color="black", formula = y ∼ poly(x, 2)) Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United StatesAustralia Norway 0.4 0.6 0.8 1.0 2.5 5.0 7.5 CPI HDI Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA pc3 <- pc2 + geom smooth( method="lm", color="black", formula = y ∼ poly(x, 2)) Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United StatesAustralia Norway 0.4 0.6 0.8 1.0 2.5 5.0 7.5 CPI HDI Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA pc3 <- pc2 + geom smooth( method="lm", color="black", formula = y ∼ poly(x, 2)) Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United StatesAustralia Norway 0.4 0.6 0.8 1.0 2.5 5.0 7.5 CPI HDI Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA pc3 <- pc2 + geom smooth( method="lm", color="black", formula = y ∼ poly(x, 2)) Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United States Australia Norway 0.4 0.6 0.8 1.0 2.5 5.0 7.5 Corruption Perception Index 2011 (10 = least) HumanDevelopmentIndex2011(1=best) Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA pc4 <- pc3 + theme bw() + scale x continuous( ...) + scale y continuous( ...) + theme( legend.position = "top", legend.direction = "horizontal") Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United States Australia Norway 0.4 0.6 0.8 1.0 2.5 5.0 7.5 Corruption Perception Index 2011 (10 = least) HumanDevelopmentIndex2011(1=best) Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA pc4 <- pc3 + theme bw() + scale x continuous( ...) + scale y continuous( ...) + theme( legend.position = "top", legend.direction = "horizontal") Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United States Australia Norway 0.4 0.6 0.8 1.0 2.5 5.0 7.5 Corruption Perception Index 2011 (10 = least) HumanDevelopmentIndex2011(1=best) Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA pc4 <- pc3 + theme bw() + scale x continuous( ...) + scale y continuous( ...) + theme( legend.position = "top", legend.direction = "horizontal") Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United States Australia Norway 0.4 0.6 0.8 1.0 2.5 5.0 7.5 Corruption Perception Index 2011 (10 = least) HumanDevelopmentIndex2011(1=best) Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA pc4 <- pc3 + theme bw() + scale x continuous( ...) + scale y continuous( ...) + theme( legend.position = "top", legend.direction = "horizontal") Baan Bapat Data Visualization with R
    • Human Development and Corruption Chad Afghanistan Nigeria Bhutan India Cape Verde Indonesia China Ecuador Saint Lucia KuwaitBahrain Italy Hong Kong United States Australia Norway 0.4 0.6 0.8 1.0 2.5 5.0 7.5 Corruption Perception Index 2011 (10 = least) HumanDevelopmentIndex2011(1=best) Region Americas APAC East Eur & Central Asia EU & West Eur MENA SSA pc4 <- pc3 + theme bw() + scale x continuous( ...) + scale y continuous( ...) + theme( legend.position = "top", legend.direction = "horizontal") Baan Bapat Data Visualization with R
    • igraph 1 2 3 4 5 67 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 Statistical network analysis igraphdemo( "cohesive") Social network of friendships between 34 members of a karate club at a US university in the 1970s Baan Bapat Data Visualization with R
    • RgoogleMaps bm1 <- GetMap(center=c(lat, long), zoom=9, maptype="terrain", destfile="bm1.png", NEWMAP=FALSE) qloc: a data frame with lat, long and attribute to be plotted with(qloc, PlotOnStaticMap(bm1, lat=lat, lon=lon, pch=19, cex=xx, col=rgb(...))) Baan Bapat Data Visualization with R
    • RgoogleMaps bm1 <- GetMap(center=c(lat, long), zoom=9, maptype="terrain", destfile="bm1.png", NEWMAP=FALSE) qloc: a data frame with lat, long and attribute to be plotted with(qloc, PlotOnStaticMap(bm1, lat=lat, lon=lon, pch=19, cex=xx, col=rgb(...))) Baan Bapat Data Visualization with R
    • RgoogleMaps bm1 <- GetMap(center=c(lat, long), zoom=9, maptype="terrain", destfile="bm1.png", NEWMAP=FALSE) qloc: a data frame with lat, long and attribute to be plotted with(qloc, PlotOnStaticMap(bm1, lat=lat, lon=lon, pch=19, cex=xx, col=rgb(...))) Baan Bapat Data Visualization with R
    • sp Plotting spatial data Swiss Language Regions french german italian require(sp) url( "http://gadm.org/ data/rda/ CHE adm1.RData") language <- c("german", ...) col = terrain.color(. . . ) spplot(gadm, ”language”, col.regions=col) Baan Bapat Data Visualization with R
    • sp Plotting spatial data Swiss Language Regions french german italian require(sp) url( "http://gadm.org/ data/rda/ CHE adm1.RData") language <- c("german", ...) col = terrain.color(. . . ) spplot(gadm, ”language”, col.regions=col) Baan Bapat Data Visualization with R
    • sp Plotting spatial data Swiss Language Regions french german italian require(sp) url( "http://gadm.org/ data/rda/ CHE adm1.RData") language <- c("german", ...) col = terrain.color(. . . ) spplot(gadm, ”language”, col.regions=col) Baan Bapat Data Visualization with R
    • sp Plotting spatial data Swiss Language Regions french german italian require(sp) url( "http://gadm.org/ data/rda/ CHE adm1.RData") language <- c("german", ...) col = terrain.color(. . . ) spplot(gadm, ”language”, col.regions=col) Baan Bapat Data Visualization with R
    • sp Plotting spatial data Swiss Language Regions french german italian require(sp) url( "http://gadm.org/ data/rda/ CHE adm1.RData") language <- c("german", ...) col = terrain.color(. . . ) spplot(gadm, ”language”, col.regions=col) Baan Bapat Data Visualization with R
    • Choropleth Choropleth: Plotting unemployment data on US map packages: rgdal, colorschemes & RColorBrewer 15 lines of code Baan Bapat Data Visualization with R
    • Interactive Visualization R + Ggobi require(rggobi) ggobi(iris) R + iplots shiny ui.R server.R runApp(¡directory¿) R + Google Chart Tools require(googleVis) demo(googleVis) World Bank country indicators data gvisMotionChart(. . . ) Baan Bapat Data Visualization with R
    • Interactive Visualization R + Ggobi require(rggobi) ggobi(iris) R + iplots shiny ui.R server.R runApp(¡directory¿) R + Google Chart Tools require(googleVis) demo(googleVis) World Bank country indicators data gvisMotionChart(. . . ) Baan Bapat Data Visualization with R
    • Interactive Visualization R + Ggobi require(rggobi) ggobi(iris) R + iplots shiny ui.R server.R runApp(¡directory¿) R + Google Chart Tools require(googleVis) demo(googleVis) World Bank country indicators data gvisMotionChart(. . . ) Baan Bapat Data Visualization with R
    • Interactive Visualization R + Ggobi require(rggobi) ggobi(iris) R + iplots shiny ui.R server.R runApp(¡directory¿) R + Google Chart Tools require(googleVis) demo(googleVis) World Bank country indicators data gvisMotionChart(. . . ) Baan Bapat Data Visualization with R
    • Success Stories Flying in the USA Glaciers melt as mountains warm Soda, pop, coke, . . . ? Baan Bapat Data Visualization with R
    • Success Stories Baan Bapat Data Visualization with R
    • Thank you! Baan Bapat Data Visualization with R