jmbm

Fig_10

Oct 10th, 2022
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 0.89 KB | None | 0 0
  1. pdf("fig_10.pdf", width = 5, height = 5)
  2. par(bty = "n", las = 1, mar = c(5, 5, 1, 1) + 0.2)
  3.  
  4. # función suma armónicos
  5. sum_arm <- function(n) {
  6.   a <- numeric(n)
  7.   for (i in 1:n) {
  8.     for (j in 1:i) {
  9.       a[j] <- a[j] + 1/i
  10.     }
  11.   }
  12.   a/n
  13. }
  14. # datos
  15. AAn <- c("Leu", "Ala", "Ser", "Gly", "Val", "Glu", "Thr", "Lys", "Ile", "Arg", "Asp", "Pro", "Asn", "Gln", "Phe", "Tyr", "Met", "His", "Cys", "Trp")
  16. AAp <- c(9.1, 7.5, 7.4, 7.1, 6.5, 6.3, 6, 5.8, 5.5, 5.2, 5.2, 5.1, 4.6, 4.1, 3.9, 3.3, 2.8, 2.2, 1.8, 1.3)
  17. n <- 20
  18. # gráfico
  19. plot(AAp, pch = 19, bty = "n", xaxt = "n", xlab = "Acids in decreasing order of abundance", ylab = "Percentage", ylim = c(0, 20))
  20. lines(AAp)
  21. axis(1, at = 1:20, labels = AAn, las = 2, cex.axis = 0.8)
  22. points(sum(AAp) * sum_arm(n), pch = 0)
  23. legend("topright", bty = "n", cex = 0.8, c("observed", "von Neumann's formula"), lwd = c(1, NA), pch = c(19, 0))
  24.  
  25.  
  26. dev.off()
Advertisement
Add Comment
Please, Sign In to add comment