I found this very appealing chart about the performance of the S&P500 from the WSJ.:
I'm trying to recreate it in R but I have no idea how to best plot the data, eg
data<-data.frame(stock=c("A","B","C","D"),group=c(rep("Fin",2),rep("Ind",2)),Perf=rnorm(4,0,1),mvalue=abs(rnorm(4,100,50)))
Has anybody a idea how to recreate it (e.g. with ggplot2?) or has anybody ever done a similar plot? Thx in advance.
Or portfolio
:
require(portfolio)
dt<-data.frame(ticker=paste0(sample(LETTERS,100,T),sample(LETTERS,100,T),sample(LETTERS,100,T)),
value=abs(rnorm(100,10000,4000)),
perc_change=rnorm(100,0,0.1),
group=sample(LETTERS[1:4],100,T)
)
rownames(dt)
map.market(dt$ticker,lab=c(T,T), area=dt$value, group=dt$group, color=dt$perc_change, main="Stock Map")