[R] Singular Spectrum Analysis Plotting Skipping in a loop, but individually it works

Michael Dewey lists at dewey.myzen.co.uk
Mon Sep 28 09:54:52 CEST 2015


Dear Dileep

What happens if you explicitly print it by wrapping the plot command in 
print(   )


On 28/09/2015 07:01, കുഞ്ഞായി kunjaai wrote:
> Dear all,
>
> I am trying to plot  Spectrum of Singular Values using "Rssa" package.
>
> I am trying to plot singular spectrum plot  inside a loop, it is not
> plotting, but when I am trying to plot individually in terminal it works,
> and I can save this as png files.
>
> My code is given below:
>
> *# --------------Calculating and plotting  Spectrum of Singular Values of
> Control---------#*
> library(ncdf)
> library(Rssa)
> season_list <-c('YEAR', 'DJF', 'JJA', 'SON', 'MAM')
> zone_list <-c('ALLIN', 'WCIND', 'IPIND', 'ECIND', 'NEIND', 'NCIND',
> 'NWIND', 'WHIND')
>
> for (sns in 1:length(season_list)){
> for (rgn in 1:length(zone_list)){
> var_noise<-paste(zone_list[rgn], "_",  season_list[sns], sep = "")
> noise1<-get.var.ncdf(f_noise1, var_noise)
> noise2<-get.var.ncdf(f_noise2, var_noise)
> # Calculating Covariance Matrix from 'noise1' matrix
> cv_noise_1 = noise1%*%t(noise1)
> sigular_spectrum = ssa(cv_noise_1, svd.method = c("eigen"))
>
> out_ssa_png =
> paste("/home/dileep/WORK/Research_wind/CMIP_PiCOntrol_Expiriments/Homogenious_zone/homogenious_tempreture_zone/Homogenous_temp_Codes/Optimal_fingerprint_code/R/ECOF-package/SSA_noise_plots/SSA_",
> zone_list[rgn], "_",  season_list[sns], "_SET_1.png", sep = "")
>
> png(out_ssa_png, width= 6, height    = 7.0, units = "in", res= 1200,
> pointsize = 3)
> print ("Created PNG file")
> titl = paste(zone_list[rgn],  season_list[sns], sep = " ")
> plot(sigular_spectrum , main=titl)
> dev.off()
> print ("Done !")
> }
> }
> *#####----------------------------------------------------------------------------------------###*
>
> Thank you in advance
>

-- 
Michael
http://www.dewey.myzen.co.uk/home.html



More information about the R-help mailing list