45 Section 4. Time series visualization with TSstudio: ts_plot

There are several big problems when visualization with the ggplot2 library: what if the viewer wants the precise stock value of a certain day? What if the viewer wants to see the exact date of one peak value? That is why we introduced the “ts_plot” library and “ploty” library to you.

TSstudio package provides a set of tools to describe, visualize, and predict time series data. ts_plot function is used to produce interactive visualization for time series objects.
By visualization time series with ts_plot, we solved the problem “the viewer might be interested in a precise data point.” By creating a graph with line.mode= “lines+markers”, the viewer can get the precise value of any data point by putting the mouse pointer to that point.

Practical Example:
Use ts_plot to visualized the Google and Amazon real stock price.

Coding Time:

#Google
ts_plot(s_price,
        title = "ts_plot: GOOG stock price",
        Xtitle = "Time",
        Ytitle = "Amazon Stock Price",
        line.mode =  "lines+markers")
#Amazon
ts_plot(s_price_amzn,
        title = "ts_plot: AMZN stock price",
        Xtitle = "Time",
        Ytitle = "AMZN Stock Price",
        line.mode =  "lines+markers")