2021年4月11日日曜日

atan plot.default pch

 
> atan2(diff(cli_xts$oecd),diff(diff(cli_xts$oecd))) %>% last(.,)
               oecd
2021-03-01 1.495797

adjust to the date of the last available data.

v <- atan2(diff(cli_xts$oecd),diff(diff(cli_xts$oecd))) %>% last(.,240)
w <- monthlyReturn(GSPC)[
"::2021-03"] %>% last(.,240) # update if necessary.
par(bg="grey",fg="white")
plot.default(v,w,type='p')
tmp <- par('usr')
plot.new()
plot.default(v,w,xlim=c( tmp[1],tmp[2]), ylim=c(tmp[3], tmp[4]),type='p')
abline(v=pi/2)
abline(v=0)
par(new=T)
i <- 12
plot.default(last(v,i),last(w,i),xlim=c( tmp[1],tmp[2]), ylim=c(tmp[3], tmp[4]),type='b',pch='+',col='brown')
for(k in seq(1,9,1)){
  j <- k %% 8 + 1
  par(new=T)
  print(i)
  print(j)
  plot.default(last(v,i)[k],last(w,i)[k],xlim=c( tmp[1],tmp[2]), ylim=c(tmp[3], tmp[4]),type='p',pch=as.character(k),col=j)
}



0 件のコメント: