Reporte Covid19 en México y Michoacán
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

119 lines
3.3 KiB

4 years ago
4 years ago
4 years ago
  1. # Preparing data
  2. clear
  3. reset
  4. set datafile separator ","
  5. set datafile missing "NaN"
  6. set bmargin at screen 0.15
  7. set lmargin at screen 0.15
  8. file="../datos/datos-covid-mexico.csv"
  9. set linestyle 1 lc rgb 'black' pt 6 ps 2 # circle
  10. set linestyle 2 lt 0 lw 3.3
  11. FIT_LIMIT = 1e-6
  12. # 1 Expo
  13. set terminal png
  14. # set output "1-1.png"
  15. # f(x) = a*exp(b*x)
  16. # fit f(x) file using 2:3 via a,b
  17. # set xlabel 'Días de Contagio' font ',12'
  18. # set xtics font ", 11"
  19. # show xlabel
  20. # set ytics font ", 11"
  21. # set ylabel 'Casos Confirmados' font ',14'
  22. # set label sprintf("f(x)=%f*e(%f*x)", a, b) at graph 0.01,0.85 font ',12'
  23. # set title 'Figura 1: Modelo Exponencial.' font ',16'
  24. # show title
  25. # set key left top font ',10' box 3
  26. # plot [1:][]file using 2:3 title 'Casos' w p ls 1, \
  27. # f(x) with lines ls 2 title 'Exponencial'
  28. # set output
  29. # unset output
  30. # unset label
  31. # # 2 Polinomico
  32. # clear
  33. # set output "1-2.png"
  34. # f(x) = a*x*x+b*x+c
  35. # fit f(x) file using 2:3 via a,b,c
  36. # set xtics font ", 13"
  37. # show xlabel
  38. # set ytics font ", 11"
  39. # set ylabel 'Casos confirmados' font ',14'
  40. # set label sprintf("f(x)=%f*x^2-%f*x+%f", a, b, c) at graph 0.01,0.85 font ',12'
  41. # set title 'Figura 2: Modelo polinomial' font ',16'
  42. # show title
  43. # set key left top font ',10' box 3
  44. # plot file using 2:3 title 'Casos' w p ls 1, \
  45. # f(x) with lines ls 2 title 'Polinomial'
  46. # set output
  47. # unset output
  48. # unset label
  49. # 3 Logaritmico
  50. clear
  51. set output "1-3.png"
  52. f(x) = a*x+b
  53. fit f(x) file using 2:9 via a, b
  54. set xlabel 'Días de contagio' font ',14'
  55. set xtics font ", 13"
  56. show xlabel
  57. set ytics font ", 11"
  58. set ylabel 'Casos confirmados' font ',14'
  59. set label sprintf("log(f(x))=%f*x+%f", a, b) at graph 0.01,0.85 font ',12'
  60. set title 'Figura 3: Modelo logarítmico' font ',16'
  61. show title
  62. set key left top font ',10' box 3
  63. plot file using 2:(log($3)) title 'Casos' w p ls 1, \
  64. f(x) with lines ls 2 title 'Log'
  65. set output
  66. unset output
  67. unset label
  68. # 4 Factor de crecimiento mexico
  69. clear
  70. set output "1-4.png"
  71. set linestyle 1 lc rgb 'black' pt 6 ps 2 # circle
  72. set linestyle 2 lt 0 lw 3.3
  73. set xlabel 'Días de contagio' font ',14'
  74. set xtics font ", 13"
  75. show xlabel
  76. set ytics font ", 11"
  77. set ylabel 'Factor de crecimiento' font ',14'
  78. set title 'Figura 4: Factor de crecimeinto díario de COVID19 en México' font ',14'
  79. show title
  80. set key off
  81. plot [1:][] file using 2:4 w lp ls 1
  82. set output
  83. unset output
  84. unset label
  85. # 5 Incremento diario
  86. clear
  87. set output "1-5.png"
  88. g(x) = c*exp(d*x)
  89. fit g(x) file using 2:6 via c, d
  90. set xlabel 'Días de contagio' font ',14'
  91. set xtics font ", 13"
  92. show xlabel
  93. set ytics font ", 11"
  94. set ylabel 'Incremento de casos diario' font ',14'
  95. set label sprintf("f(x)=%+-f*exp(%+-f*x)", c, d) at graph 0.01,0.85 font ',12'
  96. set title 'Figura 5: Modelo lineal para incrmento de los casos diarios en México' font ',14'
  97. show title
  98. set key left top font ',10' box 3
  99. plot file using 2:6 title 'Incremento' w lp ls 1, \
  100. g(x) with lines ls 2 title 'Regresor'
  101. set output
  102. unset output
  103. unset label
  104. # Factor de crecimiento Michoacan
  105. clear
  106. set output "1-7.png"
  107. set xlabel 'Días de contagio' font ',14'
  108. set xtics font ", 13"
  109. show xlabel
  110. set ytics font ", 11"
  111. set ylabel 'Factor de crecimiento' font ',14'
  112. set title 'Figura 7: Factor de crecimeinto díario de COVID19 en Michoacán' font ',14'
  113. show title
  114. set key off
  115. plot [1:][] file2 using 2:6 w lp ls 1
  116. set output
  117. unset output
  118. unset label