I am trying to graph a few different gamma distribution functions in R with the standard R commands--no packages.
As you can see here, the y-axis is being redone for each function I graph. Is there a way that I can have all 7 of my functions go along the same y-axis? Here is my code
par(mfrow=c(1,1))
x <- seq(0, 1, length = 10000)
fun1 <- function(x) dgamma(x, 1, 2)
fun2 <- function(x) dgamma(x, 2, 2)
fun3 <- function(x) dgamma(x, 3, 2)
fun4 <- function(x) dgamma(x, 5, 1)
fun5 <- function(x) dgamma(x, 9, .5)
fun6 <- function(x) dgamma(x, 7.5, 1)
fun7 <- function(x) dgamma(x, .5, 1)
plot(fun1, 0, 20, col = "red")
par(new = TRUE)
plot(fun2, 0, 20, col = "orange")
par(new = TRUE)
plot(fun3, 0, 20, col = "yellow")
par(new = TRUE)
plot(fun4, 0, 20, col = "green")
par(new = TRUE)
plot(fun5, 0, 20, col = "black")
par(new = TRUE)
plot(fun6, 0, 20, col = "blue")
par(new = TRUE)
plot(fun7, 0, 20, col = "purple")
question from:https://stackoverflow.com/questions/65886590/fixing-y-axis-labels-on-r-graph-with-several-distribution-functions