2012-04-02 17 views
3

Hallo Ich muss einen Boxplot in R. plotten Ich habe zwei Matrizen a und b. Ich erstellte einen Boxplot für a und möchte Boxplot für b auf dem gleichen Grundstück für a erstellen. Die Boxplots der b Matrix sollten auf den Whiskers des Boxplots für a liegen.Mehrere Boxplots in einem in R

Gibt es eine Möglichkeit, ich kann es in R ??

Antwort

8

Um einen Box-Plot zu einem vorhandenen Grundstück hinzuzufügen, verwenden Sie nur das Argument add=TRUE, nämlich:

##Some data 
a = rnorm(20) 
b = rnorm(20, 2, 0.3) 

##The plots 
boxplot(a) 
boxplot(b, add=TRUE, col=2) 
+0

@csgillespie in Ihrer Antwort der beiden Boxplots gestapelt sind, ist es eine Möglichkeit, ein Ergebnis wie 'boxplot zu erhalten (a, b) 'mit mehreren Calls zum' Boxplot'? –

+0

Warum nicht 'boxplot (a, b)'? – csgillespie

+0

@csgillespie, weil ich eine variable Anzahl von Boxplot habe und ich nicht im Voraus diese Nummer kenne. –