SiKiHe
SiKiHe

Reputation: 449

R mixtools plots blank composite plots

I'm trying to get familiar with the mixtools package in R, but I get a strange problem. The package is supposed to be able to "queue" plots so that the plot function first plots one plot, then another, and so on until you have reached the number of plots in your input to plot.

This doesn't work in my R version (R 3.1.2 GUI 1.65 Mavericks build (6833) on a Mac), however.

Running this code (from http://www.inside-r.org/packages/cran/mixtools/docs/plot.mixEM) gives me a plot.

data(faithful)
attach(faithful)
set.seed(100)
out <- normalmixEM(waiting, arbvar = FALSE, verb = TRUE,
               epsilon = 1e-04)
plot(out, density = TRUE, w = 1.1)

but the following, which is supposed to produce two plots, just gives me two blank quartz windows:

##Fitting randomly generated data with a 2-component location mixture of bivariate normals.

x.1 <- rmvnorm(40, c(0, 0))
x.2 <- rmvnorm(60, c(3, 4))
X.1 <- rbind(x.1, x.2)

out.1 <- mvnormalmixEM(X.1, arbvar = FALSE, verb = TRUE,
                   epsilon = 1e-03)
plot(out.1, density = TRUE, alpha = c(0.01, 0.05, 0.10), 
     marginal = TRUE)

Does anybody know what to do about this?

Thanks!

Upvotes: 1

Views: 279

Answers (1)

SiKiHe
SiKiHe

Reputation: 449

It turns out this is a bug (or what you want to call it) on all Macs.

The solution is very simple, but very surprising (for me at least).

After getting the first blank plot/quartz window, return to the main R console and simply click on it (without closing the quartz window), it says:

Hit <Return> to see next plot: 

When you hit return, you see the first plot. Returning to the main console and hitting return again will show the next plot etc.

Upvotes: 1

Related Questions