メモ

library(RFinanceYJ)
library(aplpack)
library(RColorBrewer)

SINCE <- '2012-01-01'
DATE.END <- '2012-12-31'

Yahoo <- quoteStockTsData('4689.T',since=SINCE, date.end=DATE.END)
DeNA <- quoteStockTsData('2432.T',since=SINCE, date.end=DATE.END)
GREE <- quoteStockTsData('3632.T',since=SINCE, date.end=DATE.END)
Mixi <- quoteStockTsData('2121.T',since=SINCE, date.end=DATE.END)
CA <- quoteStockTsData('4751.T',since=SINCE, date.end=DATE.END)
GungHo <- quoteStockTsData('3765.Q',since=SINCE, date.end=DATE.END)
Intage <- quoteStockTsData('4326.T',since=SINCE, date.end=DATE.END)

X <- format(DeNA[,1], "%m/%d")
Y <- cbind(	Yahoo[,7]/Yahoo[1,7],
		DeNA[,7]/DeNA[1,7],
		GREE[,7]/GREE[1,7],
		CA[,7]/CA[1,7],
		Mixi[,7]/Mixi[1,7],
	#	GungHo[,7]/GungHo[1,7],
		Intage[,7]/Intage[1,7])
cols <- brewer.pal(7, "Dark2")
par(xaxt="n")
matplot(
	y=Y,
	lwd=2,
	col=cols,
	lty=1:6,
	type="l",
	xlab="date",
	ylab="per_close")
par(xaxt="s")
axis(1,at=1:length(X),labels=X)

#abline(h=1:5,lty=2,col="gray")
#legend(100, 4, c(	"Yahoo","DeNA","GREE","CA","Mixi","GunHo","Intage"),
#       lwd=2,lty=1:6, col = cols)

abline(h=seq(0.4,1.2,0.2),lty=2,col="gray")
abline(h=1,col="gray")
legend(1, 0.7, c(	"Yahoo","DeNA","GREE","CA","Mixi","Intage"),
       lwd=2,lty=1:6, col = cols)

library(animation)
# http://www.imagemagick.org
#Define path to convert.exe (http://www.imagemagick.org)
ani.options(
	convert = shQuote('C:/Program Files/ImageMagick-6.8.1-Q16/convert.exe')
	)

test <- function(){
	for (i in 1:nrow(DeNA)) {
	DAT <- rbind(DeNA[i,-1],GREE[i,-1])
	faces(DAT,print.info=FALSE, face.type=1, main=Yahoo$date[i],labels=c("DeNA","GREE"))
	}
}

saveMovie(test(),interval=0.3,moviename="TEST",movietype="gif",outdir=getwd())

Chernoff face
WIKIPEDIA http://en.wikipedia.org/wiki/Chernoff_face
元論文(1973) http://www.apprendre-en-ligne.net/mathematica/3.3/chernoff.pdf

http://flowingdata.com/2010/08/31/how-to-visualize-data-with-cartoonish-faces/
library(aplpack)
http://www.wiwi.uni-bielefeld.de/com/wolf/software/aplpack.html

representation of the rows of a data matrix by faces. The features paramters of this implementation are:
1-height of face
2-width of face
3-shape of face
4-height of mouth
5-width of mouth
6-curve of smile
7-height of eyes
8-width of eyes
9-height of hair
10-width of hair
11-styling of hair
12-height of nose
13-width of nose
14-width of ears
15-height of ears.

http://aoki2.si.gunma-u.ac.jp/R/face.html

library(symbols)
symbol(iris,type="face",scheme=3,sortby=2,colin=5)

http://www.e-stat.go.jp/SG1/estat/List.do?bid=000001027245&cycode=0

アニメーションパッケージについては
http://d.hatena.ne.jp/EulerDijkstra/20120129/1327834316
http://www.slideshare.net/sleipnir002/animation10-11306609

http://d.hatena.ne.jp/ryamada/20110809/1312750005
http://www.slideshare.net/mickey24/r-de-animation

http://menugget.blogspot.jp/2013/01/producing-animated-gifs-and-videos.html#more