2013-02-14 22 views
1

當我運行下面的一段代碼時,我沒有得到預期的結果。我希望能夠在一個窗口中獲得所有的圖(當我做一個簡單的plot(1:5)時,它會起作用),但是隻有最後一個圖出現在左上角。par(mfrow = ...)用於來自心理圖書館的多個雙指圖表

爲什麼會發生這種情況,我該如何獲得所需的行爲?

library(psych) 
swiss2<-swiss[c(2:6)] 
rotations <- c("none", "varimax", "quatimax", 
       "promax", "oblimin", "simplimax") 

par(mfrow=c(2,3)) 
for (current_rotation in rotations){ 
    biplot(principal(swiss2, nfactors = 2, rotate = current_rotation, scores = T), 
     main = current_rotation) 
} 

注:我試着用windows()x11()不同的圖形設備。同樣的問題。

回答

0

嗯,它在這裏工作得很好。

Loading required package: GPArotation 
Erreur dans principal(swiss2, nfactors = 2, rotate = current_rotation, scores = T) (depuis #2) : 
    I am sorry, to do these rotations requires the GPArotation package to be installed 
De plus : Message d'avis : 
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : 
    there is no package called ‘GPArotation’ 

你有包GPArotation安裝:

我第一次嘗試與以下錯誤消息失敗了嗎?

enter image description here

+0

你有5塊地塊嗎?即使在安裝GPArotation之後,我也只能得到最後一幅圖。 – A5C1D2H2I1M1N2O1R2T1 2013-02-14 09:31:23

+0

@AnandaMahto嗯,是的,我甚至得到六塊地塊......只是在我的答案中添加了一個證明。 – juba 2013-02-14 09:32:00

+1

嗯。奇怪。我再次嘗試,我確實得到了六塊地塊,但是每塊地塊都是分開繪製的(並非像您一樣都在一個屏幕上)。 – A5C1D2H2I1M1N2O1R2T1 2013-02-14 09:38:33

2

這是biplot.psych個微妙的問題。

我將圖形參數重置爲從biplot.psych退出時的原始設置。 我已經修改了這個以保持op < - par(mfrow = c(2,3))#或任何 設置。

一般來說,如果你發現心理問題,如果你讓我知道,我會更快地修復它。

Bill

+0

非常感謝!我一定會讓你知道的。是否有更新版本的軟件包可用? – nassimhddd 2013-06-11 14:47:56

+0

當前版本的1.3.10(即將在1.3.10.11)在CRAN上。 – 2013-10-12 21:59:48