- Draw histgrams in 3 panes. Each pane represents
- before 2018/06/19
- between 06/21 and 07/13
- after 07/15
- Set the mean value mark by axis command.
- Output overlay text for Standard Deviation, Mean value and the number of samples.
par(mfrow=c(3,1))
hist(as.vector(last(bp.bangkok["::2018-06-19"][,2],n=length(as.vector(bp.bangkok["2018-06-21::"][,2])))),breaks=20,xlim=c(55,100),ylim=c(0,15),col=3)
# axis(side=2, pos=84,labels=F)
axis(side=2, pos=round(mean(bp.bangkok["::2018-06-19"][,2])),labels=F)
graph_dim <- par('usr')
text( (graph_dim[1] + graph_dim[2]) / 2.2 ,(graph_dim[4] - graph_dim[3]) * 0.64 + graph_dim[3] ,paste("#",round(length(bp.bangkok["2018-06-21::"][,2]),2),sep="="),adj=c(0,0))
text( (graph_dim[1] + graph_dim[2]) / 2.2 ,(graph_dim[4] - graph_dim[3]) * 0.70 + graph_dim[3] ,paste("mean",round(mean(bp.bangkok["::2018-06-19"][,2]),2),sep="="),adj=c(0,0))
text( (graph_dim[1] + graph_dim[2]) / 2.2 ,(graph_dim[4] - graph_dim[3]) * 0.76 + graph_dim[3] ,paste("sd",round(sd(bp.bangkok["::2018-06-19"][,2]),2),sep="="),adj=c(0,0))
hist(as.vector(bp.bangkok["2018-06-21::2018-07-13"][,2]),breaks=20,xlim=c(55,100),ylim=c(0,15),col=2)
axis(side=2, pos=round(mean(bp.bangkok["2018-06-21::2018-07-13"][,2])),labels=F)
graph_dim <- par('usr')
text( (graph_dim[1] + graph_dim[2]) / 2.2 ,(graph_dim[4] - graph_dim[3]) * 0.64 + graph_dim[3] ,paste("#",round(length(bp.bangkok["2018-06-21::2018-07-13"][,2]),2),sep="="),adj=c(0,0))
text( (graph_dim[1] + graph_dim[2]) / 2.2 ,(graph_dim[4] - graph_dim[3]) * 0.70 + graph_dim[3] ,paste("mean",round(mean(bp.bangkok["2018-06-21::2018-07-13"][,2]),2),sep="="),adj=c(0,0))
text( (graph_dim[1] + graph_dim[2]) / 2.2 ,(graph_dim[4] - graph_dim[3]) * 0.76 + graph_dim[3] ,paste("sd",round(sd(bp.bangkok["2018-06-21::2018-07-13"][,2]),2),sep="="),adj=c(0,0))
hist(as.vector(bp.bangkok["2018-07-15::"][,2]),breaks=10,xlim=c(55,100),ylim=c(0,15),col=4)
axis(side=2, pos=round(mean(bp.bangkok["2018-07-15::"][,2])),labels=F)
graph_dim <- par('usr')
text( (graph_dim[1] + graph_dim[2]) / 1.8 ,(graph_dim[4] - graph_dim[3]) * 0.64 + graph_dim[3] ,paste("#",round(length(bp.bangkok["2018-07-15::"][,2]),2),sep="="),adj=c(0,0))
text( (graph_dim[1] + graph_dim[2]) / 1.8 ,(graph_dim[4] - graph_dim[3]) * 0.70 + graph_dim[3] ,paste("mean",round(mean(bp.bangkok["2018-07-15::"][,2]),2),sep="="),adj=c(0,0))
text( (graph_dim[1] + graph_dim[2]) / 1.8 ,(graph_dim[4] - graph_dim[3]) * 0.76 + graph_dim[3] ,paste("sd",round(sd(bp.bangkok["2018-07-15::"][,2]),2),sep="="),adj=c(0,0))
par(mfrow=c(1,1))
0 件のコメント:
コメントを投稿