-
-
- -
-
library(ggplot2)
x<-1:10
y<-rnorm(10)
p0<-qplot(x,y,xlab="year",ylab=expression(paste(delta,tilde(F),"(t)")),geom="line")
p0<-p0+theme_bw(base_size=30)
print(p0)
-
-
- -
-
4行の図
-
-
-
- -
-
-
p1<-qplot(t1,mat_add2[,no],xlab="",ylab=paste("F(t)"),geom="line")
p1<-p1+theme_bw(base_size=17)
#+facet_grid(row=4)
p1<-p1+geom_text(aes(x=as.Date("2006-09-01"),y=70),label="(a)")
#+facet_grid(row=4)
p2<-qplot(t1,medi1,xlab="",type="l",cex.axis=2,cex.lab=1.5,tck=0.03,ylab="m(t)",geom="line")
p2<-p2+theme_bw(base_size=17)
p2<-p2+geom_text(aes(x=as.Date("2006-09-01"),y=1.2),label="(b)")
#+facet_grid(row=4)
p3<-qplot(t1,mat_add2[,no]/medi1,xlab="",type="l",cex.axis=2,cex.lab=1.5,tck=0.03,ylab=expression(paste(tilde(F),"(t)")),geom="line")
p3<-p3+theme_bw(base_size=17)
p3<-p3+geom_text(aes(x=as.Date("2006-09-01"),y=60),label="(c)")
#+facet_grid(row=4)
#dev.copy(emf,file="time_series.emf")
#dev.off()
p4<-qplot(t1[-1],diff(mat_add2[,no]/medi1),xlab="",type="l",cex.axis=2,cex.lab=1.5,tck=0.03,ylab=expression(paste(delta,tilde(F),"(t)")),geom="line")
p4<-p4+theme_bw(base_size=17)
p4<-p4+geom_text(aes(x=as.Date("2006-09-01"),y=20),label="(d)")
#+facet_grid(row=4)
pushViewport(viewport(layout=grid.layout(4, 1)))
print(p1, vp = viewport(layout.pos.row=1,layout.pos.col=1))
print(p2, vp = viewport(layout.pos.row=2,layout.pos.col=1))
print(p3, vp = viewport(layout.pos.row=3,layout.pos.col=1))
print(p4, vp = viewport(layout.pos.row=4,layout.pos.col=1))
dev.copy2eps(file="time_series2.eps")
dev.copy(png,file="time_series2.png")
dev.off()
dev.copy(pdf,file="time_series2.pdf")
dev.off()
-
-
-
-
-
- -
-
-
-
-
両対数プロット
-
-
-
- -
-
-
q0<-qplot(mean1_r,sd1_r,size=I(0.1),log="xy",xlab="Mean",ylab=expression(paste("Standard Deviation ",sqrt("V[F]")) ))
q0<-q0+theme_bw(base_size=26)
#q0<-q0 + scale_x_continuous(trans = log10_trans(), breaks = trans_breaks("log10", function(x) 10^x),labels = trans_format("log10", math_format(10^.x)))
#q0<-q0 + scale_y_continuous(trans = log10_trans(), breaks = trans_breaks("log10", function(x) 10^x),labels = trans_format("log10", math_format(10^.x)))
#q0<-q0 + scale_x_log10(trans = log10_trans(), breaks = trans_breaks("log10", function(x) 10^x),labels = trans_format("log10", math_format(10^.x)))
#q0<-q0 + scale_y_log10(trans = log10_trans(), breaks = trans_breaks("log10", function(x) 10^x),labels = trans_format("log10", math_format(10^.x)))
q0<-q0 + scale_x_log10(labels=trans_format("log10",math_format(10^.x)))
q0<-q0 + scale_y_log10(labels=trans_format("log10",math_format(10^.x)))
q0<-q0+geom_line(d=data.frame(x=exp(seq(log(10^-3.5),log(10^6),length.out=300))),aes(x=x,y=sqrt(x+0.1^2*x^2)),colour=2,size=2,linetype=2)
q0<-q0+geom_text(aes(x=10^(-3.0),y=10^5),label="(a)",size=14)
print(q0)
-
-
- -
-
両対数サイズ調整
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
q0<-qplot(mean1_r,sd1_r,size=I(1),log="xy",xlab=expression("Mean E["~F[j]~"]"),ylab=expression(paste("Standard Deviation ",sqrt("V["~F[j]~"]")) ))
q0<-q0+theme_bw(base_size=26)
#q0<-q0 + scale_x_continuous(trans = log10_trans(), breaks = trans_breaks("log10", function(x) 10^x),labels = trans_format("log10", math_format(10^.x)))
#q0<-q0 + scale_y_continuous(trans = log10_trans(), breaks = trans_breaks("log10", function(x) 10^x),labels = trans_format("log10", math_format(10^.x)))
#q0<-q0 + scale_x_log10(trans = log10_trans(), breaks = trans_breaks("log10", function(x) 10^x),labels = trans_format("log10", math_format(10^.x)))
#q0<-q0 + scale_y_log10(trans = log10_trans(), breaks = trans_breaks("log10", function(x) 10^x),labels = trans_format("log10", math_format(10^.x)))
q0<-q0 + scale_x_log10(labels=trans_format("log10",math_format(10^.x)))
q0<-q0 + scale_y_log10(labels=trans_format("log10",math_format(10^.x)))
q0= q0 + theme(axis.title.x = element_text(size=25),axis.title.y = element_text(size=25),axis.text.x = element_text(size=30),axis.text.y = element_text(size=30))
#q0= q0 + theme(axis.title.x = element_text(size=40),axis.title.y = element_text(size=20),legend.title = element_text(size=15),legend.text = element_text(size=15))
q0<-q0+geom_line(d=data.frame(x=exp(seq(log(10^-3.5),log(10^6),length.out=300))),aes(x=x,y=sqrt(x+(var(medi1)+mean(medi1^2)*delta_1^2)*x^2)),colour=2,size=2,linetype=2)
q0<-q0+geom_text(aes(x=10^(-3.0),y=10^5),label="(a)",size=14)
#q0<-q0+coord_trans(xtrans="log10", ytrans="log10")
print(q0)
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
中に小さい図の例
###Base scripts#######
library("grid")
y20<-apply(m_v_n20,1,mean,na.rm=T)
y_th<-(x0-min(x0))/mean(x0-min(x0))
d<-data.frame(x=1:365,y20=y20,y_th=y_th)
g<-ggplot(d)+theme_bw(base_size=30)
#g<-g+geom_point(aes(x,y5),colour=1,alpha=0.3)
#g<-g+geom_point(aes(x,y7),colour=2,alpha=0.3)
#g<-g+geom_point(aes(x,y10),colour=3,alpha=0.3)
g<-g+geom_point(aes(x,y20),colour=1)
g<-g+geom_line(aes(x,y20),colour=1)
#g<-g+geom_point(aes(x,y30),colour=4,alpha=0.3)
#g<-g+geom_point(aes(x,y50),colour=5,alpha=0.3)
#g<-g+scale_x_log10(label=trans_format("log10",math_format(10^.x)))
#g<-g+geom_line(aes(x,y))
g<-g+xlab("Lag (Days)")+ylab("Normalized diffusion")
g<-g+geom_line(aes(x,y_th),col=2,linetype=2,lwd=2,lty=2)
g<-g+annotate("text",label="(a)",size=15,x=13,y=1.2)
print(g)
ggsave("df_line.eps")
ggsave("df_line.png")
ggsave("df_line.wmf")
g2<-ggplot(d)+theme_bw(base_size=30)
#g<-g+geom_point(aes(x,y5),colour=1,alpha=0.3)
#g<-g+geom_point(aes(x,y7),colour=2,alpha=0.3)
#g<-g+geom_point(aes(x,y10),colour=3,alpha=0.3)
g2<-g2+geom_point(aes(x,y20),colour=1)
g2<-g2+geom_line(aes(x,y20),colour=1)
#g<-g+geom_point(aes(x,y30),colour=4,alpha=0.3)
#g<-g+geom_point(aes(x,y50),colour=5,alpha=0.3)
#g<-g+geom_line(aes(x,y))
g2<-g2+xlab("x")+ylab("y")
g2<-g2+geom_line(aes(x,y_th),col=2,linetype=2,lwd=2,lty=2)
g2<-g2+scale_x_log10(label=trans_format("log10",math_format(10^.x)))
g2b<-g2+xlab("Lag (Days)")+ylab("Normalized Diffusion")
g2b<-g2b+annotate("text",label="(a)",size=15,x=1.8,y=1.2)
print(g2b)
ggsave("df_log.eps")
ggsave("df_log.png")
ggsave("df_log.wmf")
g2c<-g2+theme_bw(base_size=20)+theme(
panel.background = element_rect(fill = "transparent",color = NA),
panel.grid.minor = element_line(color = NA),
panel.grid.major = element_line(color = NA),
plot.background = element_rect(fill = "transparent",color = NA)
)
g2c<-g2c+xlab("Lag (Days)")+ylab("Diffusion")
g2c<-g2c
print(g)
print(g2c, vp = viewport(width=0.5, height=0.5, x=0.7, y=0.48))
g4 <- recordPlot()
postscript(file="dif_a1.eps")
print(g4)
dev.off()
g4 <- recordPlot()
pdf(file="dif_a2.pdf")
print(g4)
dev.off()
g4 <- recordPlot()
png(file="dif_a3.png")
print(g4)
dev.off()
g4 <- recordPlot()
win.metafile(file="dif_a4.wmf")
print(g4)
dev.off()