കുഞ്ഞായി kunjaai
2015-Sep-28 06:01 UTC
[R] Singular Spectrum Analysis Plotting Skipping in a loop, but individually it works
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
--
DILEEPKUMAR. R
J R F, IIT DELHI
[[alternative HTML version deleted]]
Michael Dewey
2015-Sep-28 07:54 UTC
[R] Singular Spectrum Analysis Plotting Skipping in a loop, but individually it works
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
കുഞ്ഞായി kunjaai
2015-Sep-28 19:11 UTC
[R] Singular Spectrum Analysis Plotting Skipping in a loop, but individually it works
Dear Anton & Michael, Thanks a lot for your nice suggestion, Now its working.... cheers :) On Mon, Sep 28, 2015 at 1:24 PM, Michael Dewey <lists at dewey.myzen.co.uk> wrote:> 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 >-- DILEEPKUMAR. R J R F, IIT DELHI [[alternative HTML version deleted]]