How can we crop the plot until x axis = 20
basically zoom the plot from x axis = 0 until x axis = 20 and crop the rest
Also, please let me know why did the origin got cropped
Please find the reprex and screenshot attached
library(tidyverse)
mean_sim = 2.7
N = 10
up_lmt <- (max(1:N) * 2 * mean_sim)
# Setting x axis
u <- seq(from = 0,
to = up_lmt,
length.out = 1e+3)
## Curve simulation
v <- sapply(X = 1:N,
FUN = function(i) dnorm(x = u,
mean = (i * mean_sim),
sd = i))
matplot(x = u,
y = v,
type = "l",
lty = 1,
col = rainbow(n = 10),
xlab = "x axis",
ylab = "y axis",
main = "Accumulating curves")
legend(x = "topright",
title = "Curve number",
legend = 1:N,
inset = -.05,
col = rainbow(n = 10),
bty = "n",
lty = 1)