descrition of the datasets

The data set give the locations of 1000 seismic events of MB > 4.0. The events occurred in a cube near Fiji since 1964.

Multi-grapics with subplot

# Load plotly package
suppressPackageStartupMessages(library(plotly))

# We create two factors variables
quakes$magFactor <- factor(floor(quakes$mag))
quakes$region <- factor(quakes$long>=175, labels = c("West", "East"))

# Graph1
pScatter <- plot_ly(data = quakes[quakes$region == "East",], x = ~ long, y = ~ lat, name = 'East', type = 'scatter', mode = 'markers') %>% 
  add_trace(data=quakes[quakes$region == "West",], x = ~ long, y= ~ lat,  
            name = 'West', type = 'scatter', mode = 'markers')

# graph 2:
pBox <-
  plot_ly(data = quakes[quakes$region == "East",], x = ~ mag, type = "box", name = "East") %>%
  add_trace(data = quakes[quakes$region == "West",], x = ~ mag, name = "West")
# Multi-Graphic
subplot(pScatter, pBox, nrows = 1, shareX = FALSE, shareY = FALSE, margin = 0.05) %>%
  layout(title = "Longitude and latitude of earthquakes near Fiji since 1984",
         xaxis = list(title = "Longitude"),
         yaxis = list(title = "Latitude", scaleanchor = "x"),
         xaxis2 = list(title = "Magnitude"))