2017-02-14 4 views
0

Wie zeichne diese Grafik in R (ggplot2)?9 Graph Plot in einer x- und y-Achse

Format für gewünschtes Ergebnis:

Format for desired result

x <- c(0.383358433,0.814784747,0.124074272,0.115872248) 
y <- c(0.49729405,0.84456263,0.793699842,0.911446588) 
z <- qplot(x,y,geom = "line") 
z 
x1 <- c(0.383358433,0.814784747,0.124074272,0.115872248) 
y1 <- c(0.49729405,0.84456263,0.793699842,0.911446588) 
z1 <- qplot(x1,y1,geom = "line") 
z1 
x2 <- c(0.383358433,0.814784747,0.124074272,0.115872248) 
y2 <- c(0.49729405,0.84456263,0.793699842,0.911446588) 
z2 <- qplot(x2,y2,geom = "line") 
z2 
x3 <- c(0.383358433,0.814784747,0.124074272,0.115872248) 
y3 <- c(0.49729405,0.84456263,0.793699842,0.911446588) 
z3 <- qplot(x3,y3,geom = "line") 
z3 
x4 <- c(0.383358433,0.814784747,0.124074272,0.115872248) 
y4 <- c(0.49729405,0.84456263,0.793699842,0.911446588) 
z4 <- qplot(x4,y4,geom = "line") 
z4 
x5 <- c(0.383358433,0.814784747,0.124074272,0.115872248) 
y5 <- c(0.49729405,0.84456263,0.793699842,0.911446588) 
z5 <- qplot(x,y,geom = "line") 
z5 
require(gridExtra) 
grid.arrange(z,z1,z2,z3,z4,z5) 

Ich habe versucht, mit ggplot aber ich konnte nicht das gewünschte Ergebnis erhalten.

+0

Willkommen bei Stackoverflow! Verbringe etwas Zeit mit dem Lesen [wie man ein reproduzierbares Beispiel schreibt] (http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), benutze 'dput (DF)' um Ihre Beispieldaten zu posten und auch '? facet_wrap' – OdeToMyFiddle

+1

Willkommen bei Stack Overflow. Bitte verwenden Sie keine Großbuchstaben. – Vincent

+0

Bitte schauen Sie sich 'facet_wrap()' aus dem Paket 'ggplot2' an. – Uwe

Antwort

0

Gerade von der Hilfeseite von ?grid.arrange

plotList = list(z,z1,z2,z3,z4,z5) 
arrangedPlot = marrangeGrob(plotList,nrow=3,ncol=3) 
ggsave("multipage.png", arrangedPlot,device="png") 

Grundstück:

enter image description here

+0

klicken Sie auf Format für das gewünschte Ergebnis: Ich möchte dieses Format – statistician

+0

Wie ich in den Kommentaren erwähnt, schauen Sie sich 'facet_wrap' an. Dies wird so viel ausgegeben haben, wie Sie es erwarten, für weitere "Verbesserungen" müssen Sie mit Grobbutteln herumspielen oder, wenn Sie Glück haben, könnte @baptiste darüber stolpern – OdeToMyFiddle