managing v is u al comple x it y
play

Managing v is u al comple x it y DATA VISU AL IZATION IN R Ron - PowerPoint PPT Presentation

Managing v is u al comple x it y DATA VISU AL IZATION IN R Ron Pearson Instr u ctor Usef u l v is u ali z ations sho w u s details DATA VISUALIZATION IN R Usef u l v is u ali z ations sho w u s details DATA VISUALIZATION IN R Usef u l v is u


  1. Managing v is u al comple x it y DATA VISU AL IZATION IN R Ron Pearson Instr u ctor

  2. Usef u l v is u ali z ations sho w u s details DATA VISUALIZATION IN R

  3. Usef u l v is u ali z ations sho w u s details DATA VISUALIZATION IN R

  4. Usef u l v is u ali z ations don ' t sho w too man y details DATA VISUALIZATION IN R

  5. M u ltiple scatterplots on one set of a x es : matplot () library(MASS) matplot(Cars93$Horsepower, Cars93[, c("MPG.city", "MPG.highway")], xlab = "Horsepower", ylab = "Gas mileages") legend("topright", pch = c("1", "2"), col = c("black", "red"), legend = c("MPG.city", "MPG.highway")) DATA VISUALIZATION IN R

  6. library(MASS) matplot(Cars93$Horsepower, Cars93[, c("MPG.city", "MPG.highway")], xlab = "Horsepower", ylab = "Gas mileages") legend("topright", pch = c("1", "2"), col = c("black", "red"), legend = c("MPG.city", "MPG.highway")) DATA VISUALIZATION IN R

  7. Let ' s practice ! DATA VISU AL IZATION IN R

  8. Creating plot arra y s w ith the mfro w parameter DATA VISU AL IZATION IN R Ron Pearson Instr u ctor

  9. M u ltiple plot arra y s Di � erences bet w een datasets Di � erent v ie w s of the same dataset Similarities bet w een datasets Related v ie w s of same dataset DATA VISUALIZATION IN R

  10. DATA VISUALIZATION IN R

  11. Set u p plot arra y w ith R ro w s and C col u mns library(MASS) par(mfrow = c(2, 3)) # Set up a 2-row, 3-column array plot(UScereal$fat, UScereal$calories) title("Calories vs. fat") plot(UScereal$carbo, UScereal$calories) title("Calories vs. carbo") plot(UScereal$sugars, UScereal$calories) title("Calories vs. sugars") plot(UScereal$fat, UScereal$fibre) title("Fibre vs. fat") plot(UScereal$carbo, UScereal$fibre) title("Fibre vs. carbo") plot(UScereal$sugars, UScereal$fibre) title("Fibre vs. sugars") DATA VISUALIZATION IN R

  12. DATA VISUALIZATION IN R

  13. Creating side - b y- side plot pairs library(MASS) par(mfrow = c(1, 2)) plot(density(geyser$duration), main = "Duration") plot(density(geyser$waiting), main = "Waiting time") DATA VISUALIZATION IN R

  14. Creating side - b y- side plot pairs library(MASS) par(mfrow = c(1, 2)) par(pty = "s") plot(density(geyser$duration), main = "Duration") plot(density(geyser$waiting), main = "Waiting time") DATA VISUALIZATION IN R

  15. Let ' s practice ! DATA VISU AL IZATION IN R

  16. Creating plot arra y s w ith the la y o u t () f u nction DATA VISU AL IZATION IN R Ron Pearson Instr u ctor

  17. la y o u t () u ses a matri x to define the plot arra y rowA <- c(1, 1, 1) rowB <- c(2, 0, 3) layoutVector <- c(rowA, rowA, rowB) layoutMatrix <- matrix(layoutVector, byrow = TRUE, nrow = 3) layoutMatrix [,1] [,2] [,3] [1,] 1 1 1 [2,] 1 1 1 [3,] 2 0 3 DATA VISUALIZATION IN R

  18. la y o u t . sho w() sho w s the str u ct u re of the arra y layout(layoutMatrix) # Use the matrix constructed previously layout.show(n = 3) See layout of all three plots DATA VISUALIZATION IN R

  19. la y o u t () helps create non - rectang u lar plot arra y s DATA VISUALIZATION IN R

  20. la y o u t () helps create non - rectang u lar plot arra y s rowA <- c(1, 1, 1) rowB <- c(2, 0, 3) layoutVector <- c(rowA, rowA, rowB) layoutMatrix <- matrix(layoutVector, byrow = TRUE, nrow = 3) layout(layoutMatrix) library(MASS) plot(UScereal$sugars, UScereal$calories, pch = 15, col = "magenta") title("Long, skinny scatterplot across the top of the array") plot(density(UScereal$sugars), main = "Small left-hand plot: \n Sugars density") plot(density(UScereal$calories), main = "Small right-hand plot: \n Calories density") DATA VISUALIZATION IN R

  21. Let ' s practice ! DATA VISU AL IZATION IN R

Recommend


More recommend