---
title: "Iris Species Data Visualizations"
author: "Ying Wang"
output:
  html_document: default
  highlight: zenburn
  pdf_document: default
  theme: united
---


_________________________________________________________________

```{r echo=FALSE}
library(ggplot2)
library(base)
library(plot3D)
iris=read.csv('Iris.csv')
```
# 1
```{r echo=FALSE}
p1 = ggplot(data = iris) +
geom_point(mapping = aes(x=SepalWidthCm, y=SepalLengthCm, color = Species))

p1 +theme_minimal()
```

# 2

```{r echo=FALSE}
p2 = ggplot(data =iris,aes(Species,SepalLengthCm,colour=Species)) + geom_boxplot() +theme_minimal() 
p3 = ggplot(data =iris,aes(Species,SepalWidthCm,colour=Species)) + geom_boxplot() +theme_minimal() 
p4 = ggplot(data =iris,aes(Species,PetalLengthCm,colour=Species)) + geom_boxplot() +theme_minimal() 
p5 = ggplot(data =iris,aes(Species,PetalWidthCm,colour=Species)) + geom_boxplot() +theme_minimal() 
lay_out = function(...) {    
    x <- list(...)
    n <- max(sapply(x, function(x) max(x[[2]])))
    p <- max(sapply(x, function(x) max(x[[3]])))
    grid::pushViewport(grid::viewport(layout =grid::grid.layout(n, p)))    
    for (i in seq_len(length(x))) {
        print(x[[i]][[1]], vp = grid::viewport(layout.pos.row =x[[i]][[2]], 
            layout.pos.col = x[[i]][[3]]))
    }
} 
lay_out(list(p2, 1, 1),
       list(p3, 1, 2),
       list(p4, 2, 1),
       list(p5,2,2))
```

# 3

```{r echo=FALSE}
scatter3D(iris$SepalLengthCm, 
          iris$SepalWidthCm, 
          iris$PetalLengthCm,  
          colvar = NULL, 
          col = iris$Species, 
          xlab = "sepal length", 
          ylab = "sepal width",
          zlab = "petal length",
          clab = "species",
          theta =300,
          phi = 20,
          pch = 20,
          cex = 1,
          add = FALSE)

scatter3D(iris$SepalLengthCm, 
          iris$SepalWidthCm, 
          iris$PetalLengthCm,  
          colvar = NULL, 
          col = iris$Species, 
          xlab = "sepal length", 
          ylab = "sepal width",
          zlab = "petal length",
          clab = "species",
          theta =240,
          phi = 20,
          pch = 20,
          cex = 1,
          add = FALSE)
```















