1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| library(gdata)
library(pracma)
library(RColorBrewer)
#####################################################################
NameVille<-c("Bon", "Am","Mas","Nama","Mon","Goz-Beï","Massy","Athoul","Bo","Mou","Beche", "Bie","Fa", "Do", "Ya","Borh","Moun","Koua","Sais","Pla","Wari", "Mua","An-Dja")
############################################################################
Month=c("Jan","Feb","March","April","May","Jun","July","August","Sept","Oct","Nov","Dec")
########################################################################"
NameVille<-sort(NameVille)
#######################################################################
n<-length(NameVille)
################################# Indices des mois de janvier
Ilab = which(temp[,2]==1)
# On récupère les années de ces indices
Xlab = temp[Ilab,1]
##############################################""
X<-temp[,3:25]
taille<-dim(X)
Ndata<-taille[1]
Nbvar<-taille[2]
################################"
ColorsPaired=brewer.pal(12,"Paired")
ColorsSet3=brewer.pal(12,"Set3")
ColorsAll<-c(ColorsSet3,ColorsPaired)
ColorsAll<-sample(c(ColorsSet3,ColorsPaired))
###########################################
ymax=max(X,na.rm=T)
ymin=min(X,na.rm=T)
Year=unique(temp[,1])
xlab1=c("1980","1981","1982","1983","1984","1985","1986","1987","1988","1989")
xlab2=c("1990","1991","1992","1993","1994","1995","1996","1997","1998","1999")
xlab3=c("2000","2001","2002","2003","2004","2005","2006","2007","2008","2009")
xlab4=c("2010","2011","2012","2013","2014","2015","2016","2017")
labYear=c(xlab1,xlab2,xlab3,xlab4)
legendx=colnames(temp)[3:25]
Year=as.character(temp[,1])
#par(mfrow=c(4,6))
for (i in 1:9)
{
#plot(1:Ndata,X[,i],type="l",main=colnames(temp)[i+2],xlab='Mois',ylab='Température',ylim=c(ymin,ymax))
plot(1:Ndata,X[,i],pch=1,lty=1,type="l",col=ColorsAll[i],ylim=c(ymin,ymax),lwd=2,xaxt="n",xlab="Années",main="Temperature en °C par ville",ylab="Temperature en °C")
par(new=TRUE)
}
axis(1,at=c(1:456), labels=Year)
#axis(1,at=c(1:38), labels=labYear)
grid()
Couleurs=ColorsAll[1:Nbvar]
legend(x="bottomright", legend=legendx,col=Couleurs,cex=.9,text.col = "black",lty=1,lwd=2) |
Partager