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.
 

147 lines
4.0 KiB

# Preparing data
clear
reset
set datafile separator ","
set datafile missing "NaN"
set bmargin at screen 0.15
set lmargin at screen 0.15
file="../datos/datos-covid-mexico.csv"
set linestyle 1 lc rgb 'black' pt 6 ps 2 # circle
set linestyle 2 lt 0 lw 3.3
FIT_LIMIT = 1e-6
# 1 Expo
set terminal png
set output "1-1.png"
f(x) = a*exp(b*x)
fit f(x) file using 2:3 via a,b
set xlabel 'Días de Contagio' font ',12'
set xtics font ", 11"
show xlabel
set ytics font ", 11"
set ylabel 'Casos Confirmados' font ',14'
set label sprintf("f(x)=%f*e(%f*x)", a, b) at graph 0.01,0.85 font ',12'
set title 'Figura 1: Modelo Exponencial.' font ',16'
show title
set key left top font ',10' box 3
plot [1:][]file using 2:3 title 'Casos' w p ls 1, \
f(x) with lines ls 2 title 'Exponencial'
set output
unset output
unset label
# 2 Polinomico
FIT_LIMIT = 1e-6
f(x) = a*x*x+b*x+c
fit f(x) file using 2:3 via a,b,c
set xtics font ", 13"
show xlabel
set ytics font ", 11"
set ylabel 'Casos confirmados' font ',14'
set label sprintf("f(x)=%f*x^2-%f*x+%f", a, b, c) at graph 0.01,0.85 font ',12'
set title 'Figura 2: Modelo polinomial' font ',16'
show title
set key left top font ',10' box 3
plot file using 2:3 title 'Casos' w p ls 1, \
f(x) with lines ls 2 title 'Polinomial'
set output "1-2.png"
replot
unset output
unset label
# Logaritmico
clear
set datafile separator ","
set datafile missing "NaN"
file="../datos/datos-covid-mexico.csv"
set linestyle 1 lc rgb 'black' pt 6 ps 2 # circle
set linestyle 2 lt 0 lw 3.3
FIT_LIMIT = 1e-6
f(x) = a*x+b
fit f(x) file using 2:9 via a, b
set xlabel 'Días de contagio' font ',14'
set xtics font ", 13"
show xlabel
set ytics font ", 11"
set ylabel 'Casos confirmados' font ',14'
set label sprintf("log(f(x))=%f*x+%f", a, b) at graph 0.01,0.85 font ',12'
set title 'Figura 3: Modelo logarítmico' font ',16'
show title
set key left top font ',10' box 3
plot file using 2:(log($3)) title 'Casos' w p ls 1, \
f(x) with lines ls 2 title 'Log'
set output "1-3.png"
replot
unset output
unset label
# 4 Factor de crecimiento mexico
clear
set linestyle 1 lc rgb 'black' pt 6 ps 2 # circle
set linestyle 2 lt 0 lw 3.3
set xlabel 'Días de contagio' font ',14'
set xtics font ", 13"
show xlabel
set ytics font ", 11"
set ylabel 'Factor de crecimiento' font ',14'
set title 'Figura 4: Factor de crecimeinto díario de COVID19 en México' font ',14'
show title
set key off
plot [1:][] file using 2:4 w lp ls 1
set output "1-4.png"
replot
unset output
unset label
# Incremento diario
clear
reset
FIT_LIMIT = 1e-6
g(x) = c*exp(d*x)
fit g(x) file using 2:6 via c, d
set xlabel 'Días de contagio' font ',14'
set xtics font ", 13"
show xlabel
set ytics font ", 11"
set ylabel 'Incremento de casos diario' font ',14'
set label sprintf("f(x)=%+-f*x%+-f", a, b) at graph 0.01,0.85 font ',12'
set title 'Figura 5: Modelo lineal para incrmento de los casos diarios en México' font ',14'
show title
set key left top font ',10' box 3
plot file using 2:6 title 'Incremento' w lp ls 1, \
g(x) with lines ls 2 title 'Regresor'
set output "1-5.png"
replot
unset output
unset label
# 6 Modelo lineal Michoacan
clear
file2="../datos/datos-covid-michoacan.csv"
f(x) = a*x+b
fit f(x) file2 using 2:3 via a, b
set xlabel 'Días de contagio' font ',14'
set xtics font ", 13"
show xlabel
set ytics font ", 11"
set ylabel 'Casos confirmados' font ',14'
set label sprintf("f(x)=%+-f*x%+-f", a, b) at graph 0.01,0.85 font ',12'
set title 'Figura 6: Modelo lineal para los casos en Michoacán' font ',14'
show title
set key left top font ',10' box 3
plot file2 using 2:3 title 'Casos' w p ls 1, \
f(x) with lines ls 2 title 'Modelo'
set output "1-6.png"
replot
unset output
unset label
# Factor de crecimiento Michoacan
clear
set xlabel 'Días de contagio' font ',14'
set xtics font ", 13"
show xlabel
set ytics font ", 11"
set ylabel 'Factor de crecimiento' font ',14'
set title 'Figura 7: Factor de crecimeinto díario de COVID19 en Michoacán' font ',14'
show title
set key off
plot [1:][] file2 using 2:6 w lp ls 1
set output "1-7.png"
replot
unset output
unset label