Analyzing Air Quality Dataset

Using plotly, we can analyse the airquality dataset. Here, we have plotted the scatter3d plot-type of the plot_ly function from the plotly package.

Taking Ozone on x-axis, Solar Radiation on the y-axis, Wind on the z-axis and the color of the various points according to the Month factor, we get the following scatterplot.

library(plotly)
data("airquality")
head(airquality)
##   Ozone Solar.R Wind Temp Month Day
## 1    41     190  7.4   67     5   1
## 2    36     118  8.0   72     5   2
## 3    12     149 12.6   74     5   3
## 4    18     313 11.5   62     5   4
## 5    NA      NA 14.3   56     5   5
## 6    28      NA 14.9   66     5   6
air <- airquality[complete.cases(airquality), ]
Ozone <- air$Ozone
Solar_Radiation <- air$Solar.R
Wind <- air$Wind
Month <- air$Month
plot_ly(x = ~Ozone, y = ~Solar_Radiation, z = ~Wind,
         type = "scatter3d", color = ~Month, mode   = 'markers')