Reputation:
Does anyone know how to produce a graph like this? like 9 graphs in total and share the same x-axis and y-axis?
Upvotes: 2
Views: 79
Reputation:
Strictly speaking your Question is about programming and so 'off-topic' here. But it is almost easier to give an answer than to direct you elsewhere. (And the displays you ask about are often useful for data description and statistical analysis.) In standard R graphics:
par(mfrow=c(1,3)) # enables 1x3 array of plots
hist(rnorm(1000, 50, 7), prob=T)
hist(rexp(1000, .01), prob=T)
hist(rbeta(1000, 3, 5), prob=T)
par(mfrow=c(1,1)) # returns to single panel graphs
par(mfcol=c(2,2)) # enables array filled by columns
x = rnorm(500, 100, 20)
hist(x, prob=T, col="skyblue2")
qqnorm(x, datax=T)
qqline(x, datax=T, col="green2", lwd=2)
y = rexp(500, .5)
hist(y, prob=T, col="wheat")
qqnorm(y, datax=T)
qqline(y, datax=T, col="green2", lwd=2)
par(mfcol=c(1,1)) # returns to single
Upvotes: 2