46 Section 5. Time series visualization with Plotly

Plotly creates high-quality, interactive, web-based data visualization in R. Plotly uses the pipe operator %>% instead of plus sign.
Practical Example:
This time, Use ploty to visualized the Google Adjusted stock price, and Google & Amazon Adjusted stock price.
Coding Time:

# convert time series to data frame object
df <- data.frame(ts_bind)
df$date <- as.Date(rownames(df))
plot_ly(df, type = 'scatter', mode = 'lines')%>%
  add_trace(x = ~date, y = ~GOOG.Adjusted, name = 'GOOG')%>%
  layout(showlegend = F, title = 'GOOG Adjusted stock price')
plot_ly(df, type = 'scatter', mode = 'lines')%>%
  add_trace(x = ~date, y = ~GOOG.Adjusted, name = 'GOOG')%>%
  add_trace(x = ~date, y = ~AMZN.Adjusted, name = 'AMZN')%>%
  layout(showlegend = F, title = 'GOOG and AMZN Adjusted stock price')

references:

http://www.quantmod.com

https://www.openriskmanagement.com/21_ways_to_visualize_a_timeseries/

https://r-graph-gallery.com/time-series.html

https://plotly.com/r/time-series/

https://rstudio-pubs-static.s3.amazonaws.com/464590_529f604d55674bd3a046d7e76f862a1f.html