[R] Missing x label in barplot

ani jaya g@@@uu| @end|ng |rom gm@||@com
Thu May 14 07:40:57 CEST 2020


Dear R community,

I found some missing x label when I saving this plot to tiff file:

justsample <- rnorm(n=1095*3,mean=100,sd=10)
justsample <- as.data.frame(matrix(justsample,ncol=3))
dd <- seq(from=as.Date("1985-01-01"), to =as.Date("1987-12-31"), by='day')
y <- data.frame(Year=substr(dd,1,4),
              Month=substr(dd,6,7),
              Day=substr(dd,9,10), stringsAsFactors = FALSE)


clim <- aggregate(justsample,list(y$Month),mean,na.rm=TRUE)
for (i in 1:3){
  file_name <- paste("clim_bug", i, ".tiff", sep="")
  tiff(file_name)
barplot(clim[,i+1], ylab="Daily rainfall (mm)", xlab="Time (month)",
        main="Climatological Mean",
        names.arg=c("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
"Aug", "Sep", "Oct","Nov","Dec"),
        col="cadetblue3", cex.axis = 1, ylim=c(0,120))
dev.off()
}

I can see complete x label in plots window in RStudio and I thought it
was RStudio error
but I also have some error in Rgui.

I believe my code is terrible and as newbie R, I welcome to any
suggestions and comments.


> sessionInfo()
R version 3.6.3 (2020-02-29)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)


Best,
Ani



More information about the R-help mailing list