jmbm

Fig_02

Oct 10th, 2022
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.53 KB | None | 0 0
  1. pdf("fig_02.pdf", width = 5, height = 5)
  2. par(bty = "n", las = 1, mar = c(3, 4, 4, 1) + 0.2)
  3. #---- El grande a la izquierda
  4. n <- 100 # número de tiras
  5. izq <- numeric()
  6. dch <- numeric()
  7. for (i in 1:n) {
  8.   izq[i] <- runif(1)
  9.   if (izq[i] < 0.5) {
  10.     izq[i] <- 1 - izq[i]
  11.   }
  12.   dch[i] <- 1 - izq[i]
  13. }
  14. monton_izq <- sum(izq)
  15. monton_dch <- sum(dch)
  16. barplot(c(monton_izq, monton_dch), names.arg = c("izquierda", "derecha"), col = c("darkorange", "lightblue"), ylab = "tamaño del montón", main = "LARGO A LA IZQUIERDA")
  17. dev.off()
Advertisement
Add Comment
Please, Sign In to add comment