其他實用的視覺化函式

在 R 視覺化時間序列資料

Arnaud Amsellem

Quantitative Trader and creator of the R Trader blog

其他實用的視覺化函式

ch1_vid2_slides.003.png

plot(my_ts, main = "My Stocks")
在 R 視覺化時間序列資料

其他實用的視覺化函式

ch1_vid2_slides.005.png

plot(my_ts, main = "My Stocks")
lines(my_ts2, col = "red")
在 R 視覺化時間序列資料

其他實用的視覺化函式

ch1_vid2_slides.007.png

plot(my_ts, main = "My Stocks")
lines(my_ts2, col = "red")
axis(side = 4, at = pretty(my_ts2))
在 R 視覺化時間序列資料

其他實用的視覺化函式

ch1_vid2_slides.023.png

plot(my_ts, main = "My Stocks")
lines(my_ts2, col = "red")
axis(side = 4, at = pretty(my_ts2))
legend(x = "bottomright", legend = c("Stock X", "Stock Y"),
       col = c("black", "red"), lty = c(1, 1))
在 R 視覺化時間序列資料

abline() 範例

abline(v = as.Date("2016-04-14"))

ch1_vid2_slides.028.png

在 R 視覺化時間序列資料

abline() 範例

abline(v = as.Date("2016-04-14"))

ch1_vid2_slides.028.png

abline(h = 1)

ch1_vid2_slides.030.png

在 R 視覺化時間序列資料

其他實用的視覺化函式

plot(my_ts, main = "My Stocks")
lines(my_ts2, col = "red")
axis(side = 4, at = pretty(my_ts2))
legend(x = "bottomright", legend = c("Stock X", "Stock Y"),
       col = c("black", "red"), lty = c(1, 1))
abline(h = 10)

ch1_vid2_slides.034.png

在 R 視覺化時間序列資料

其他實用的視覺化函式

library(PerformanceAnalytics)
period <- c("2014-01/2015-06")
chart.TimeSeries(my_ts, period.areas = period, main = "my_ts")

ch1_vid2_slides.039.png

在 R 視覺化時間序列資料

一起來練習吧!

在 R 視覺化時間序列資料

Preparing Video For Download...