Consider the following example: library("kdecopula") library("mvtnorm") pobs <- function(x) rank(x) / (length(x) + 1) n <- 1000 sigma1 <- diag(x = 1, 2, 2) x1 <- rmvnorm(n, sigma = sigma1) xx1 <- apply(x1, 2, pobs) cop1 <- kdecop(xx1) eps <- 0.8 sigma2 <- matrix(c(1, eps, eps, 1), ncol = 2) x2 <- rmvnorm(n, sigma = sigma2) xx2 <- apply(x2, 2, pobs) cop2 <- kdecop(xx2) x11() plot(cop1, main = "cop1 main") x11() plot(cop2, main = "cop2 main") cplot <- function(cop1, cop2) { x11() plot(cop1, main = "cop1 function") x11() plot(cop2, main = "cop2 function") } cplot(cop1, cop2) cat("Press <Enter> to quit") readLines(file("stdin"), n ? ? ? ? 1) quit() When I run it with Rscript all four x11 windows pop up, however the one that should display "cop1 function" is blank, the wireframe is not plotted. This is R 3.3.1, on Fedora 20. I see similar behaviour on Fedora 24, R 3.3.3 when I run the code from RStudio (the most recent one). George [[alternative HTML version deleted]]
FAQ 7.22 And don't send HTML email... you are the one making it difficult for us to read your question. -- Sent from my phone. Please excuse my brevity. On April 21, 2017 8:27:20 AM PDT, George Trojan - NOAA Federal <george.trojan at noaa.gov> wrote:>Consider the following example: > >library("kdecopula") >library("mvtnorm") > >pobs <- function(x) rank(x) / (length(x) + 1) > >n <- 1000 > >sigma1 <- diag(x = 1, 2, 2) >x1 <- rmvnorm(n, sigma = sigma1) >xx1 <- apply(x1, 2, pobs) >cop1 <- kdecop(xx1) > >eps <- 0.8 >sigma2 <- matrix(c(1, eps, eps, 1), ncol = 2) >x2 <- rmvnorm(n, sigma = sigma2) >xx2 <- apply(x2, 2, pobs) >cop2 <- kdecop(xx2) > >x11() >plot(cop1, main = "cop1 main") >x11() >plot(cop2, main = "cop2 main") > >cplot <- function(cop1, cop2) { > x11() > plot(cop1, main = "cop1 function") > x11() > plot(cop2, main = "cop2 function") >} > >cplot(cop1, cop2) > >cat("Press <Enter> to quit") >readLines(file("stdin"), n >? ? >>? ? >1) >quit() > >When I run it with Rscript all four x11 windows pop up, however the one >that should display "cop1 function" is blank, the wireframe is not >plotted. >This is R 3.3.1, on Fedora 20. >I see similar behaviour on Fedora 24, R 3.3.3 when I run the code from >RStudio (the most recent one). > >George > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.
Thanks. After changing the function to cplot <- function(cop1, cop2) { x11() o <- plot(cop1, main = "cop1 function") print(o) x11() o <- plot(cop2, main = "cop2 function") print(o) } I see both plots. But, since "cop2 function" was plotted before, does it mean it is plotted twice now? Looks as a strange design. I did check the "Plain text mode" in Chrome, you should see only the text part. George On 21 April 2017 at 16:27, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:> FAQ 7.22 > And don't send HTML email... you are the one making it difficult for us to read your question. > > -- > Sent from my phone. Please excuse my brevity. > > On April 21, 2017 8:27:20 AM PDT, George Trojan - NOAA Federal <george.trojan at noaa.gov> wrote: >>Consider the following example: >> >>library("kdecopula") >>library("mvtnorm") >> >>pobs <- function(x) rank(x) / (length(x) + 1) >> >>n <- 1000 >> >>sigma1 <- diag(x = 1, 2, 2) >>x1 <- rmvnorm(n, sigma = sigma1) >>xx1 <- apply(x1, 2, pobs) >>cop1 <- kdecop(xx1) >> >>eps <- 0.8 >>sigma2 <- matrix(c(1, eps, eps, 1), ncol = 2) >>x2 <- rmvnorm(n, sigma = sigma2) >>xx2 <- apply(x2, 2, pobs) >>cop2 <- kdecop(xx2) >> >>x11() >>plot(cop1, main = "cop1 main") >>x11() >>plot(cop2, main = "cop2 main") >> >>cplot <- function(cop1, cop2) { >> x11() >> plot(cop1, main = "cop1 function") >> x11() >> plot(cop2, main = "cop2 function") >>} >> >>cplot(cop1, cop2) >> >>cat("Press <Enter> to quit") >>readLines(file("stdin"), n >> >>>> >>1) >>quit() >> >>When I run it with Rscript all four x11 windows pop up, however the one >>that should display "cop1 function" is blank, the wireframe is not >>plotted. >>This is R 3.3.1, on Fedora 20. >>I see similar behaviour on Fedora 24, R 3.3.3 when I run the code from >>RStudio (the most recent one). >> >>George >> >> [[alternative HTML version deleted]] >> >>______________________________________________ >>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >>https://stat.ethz.ch/mailman/listinfo/r-help >>PLEASE do read the posting guide >>http://www.R-project.org/posting-guide.html >>and provide commented, minimal, self-contained, reproducible code.