Ashley
Ashley

Reputation: 155

Display Multiple Histograms in the same Panel using Graphics R

I am trying to print multiple histograms in the same window in R. I am using R Studio. I can only use the built in graphics package. I have been unable to find a solution to my problem on here already.

I am trying to create histograms of the iris data set.

For example:

one histogram for sepal width, another for sepal length, and so on.

Thanks!

Upvotes: 1

Views: 6040

Answers (1)

Forrest R. Stevens
Forrest R. Stevens

Reputation: 3485

As Backlin commented above, you can use the par() function and mfrow option to control subplots:

par(mfrow=c(2,2))

hist(iris$Sepal.Width)
hist(iris$Sepal.Length)
hist(iris$Petal.Width)
hist(iris$Petal.Length)

Upvotes: 1

Related Questions