Not having a great day today, so I have been playing with charts.

Here is one that I have been meaning to make for ages. I like to look at some markets as scatter plots, with the market price on the vertical axis and some explanatory variable on the horizontal axis. I also like these plots to be coloured according to the full spectrum, with the oldest data points in red and the newest ones in purple (and the last data point as a magenta triangle). So I have made a function in R that chucks these out quickly.

rainbowplot=function(X,Y,...){
 plot(Y~X,col=rainbow(length(X),start=0,end=0.78),pch=20,...)
 points(Y[length(X)]~X[length(X)],pch=17,col="magenta",...)
}

Here is an example, showing AUD/USD against the 2-year real interest rate differential, from June 2009 to today. Note that both series are recentred to have mean zero, and expressed in standard deviations from the mean (just because that’s how the data happened to be set up in the spreadsheet from which I took it).

Rplot01

Advertisements