Browse Source

gnuplot scripts

master
parent
commit
05b235574f
11 changed files with 408 additions and 1 deletions
  1. +0
    -1
      .gitignore
  2. BIN
      DATOS COVID 1:04:2020.xlsx
  3. BIN
      plots/.DS_Store
  4. BIN
      plots/covid-numbers.numbers
  5. +15
    -0
      plots/factor-mexico.gp
  6. +15
    -0
      plots/factor-michoacan.gp
  7. +147
    -0
      plots/fig-gen.bk
  8. +140
    -0
      plots/fig-gen.gp
  9. +29
    -0
      plots/figura1.gp
  10. +31
    -0
      plots/figura5.gp
  11. +31
    -0
      plots/figura8.gp

+ 0
- 1
.gitignore View File

@ -1,2 +1 @@
plots/
/.DS_Store /.DS_Store

BIN
DATOS COVID 1:04:2020.xlsx View File


BIN
plots/.DS_Store View File


BIN
plots/covid-numbers.numbers View File


+ 15
- 0
plots/factor-mexico.gp View File

@ -0,0 +1,15 @@
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
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 ',18'
show title
set key off
plot [1:][] file using 2:4 w lp ls 1

+ 15
- 0
plots/factor-michoacan.gp View File

@ -0,0 +1,15 @@
clear
set datafile separator ","
set datafile missing "NaN"
file="../datos/datos-covid-michoacan.csv"
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 7: Factor de crecimeinto díario de COVID19 en Michoacán' font ',18'
show title
set key off
plot [1:][] file using 2:6 w lp ls 1

+ 147
- 0
plots/fig-gen.bk View File

@ -0,0 +1,147 @@
# 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

+ 140
- 0
plots/fig-gen.gp View File

@ -0,0 +1,140 @@
# 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
clear
set output "1-2.png"
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
unset output
unset label
# 3 Logaritmico
clear
set output "1-3.png"
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
unset output
unset label
# 4 Factor de crecimiento mexico
clear
set output "1-4.png"
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
unset output
unset label
# 5 Incremento diario
clear
set output "1-5.png"
f(x) = a*exp(b*x)
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*exp(%+-f*x)", c, d) 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
unset output
unset label
# 6 Modelo lineal Michoacan
clear
file2="../datos/datos-covid-michoacan.csv"
set output "1-6.png"
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
unset output
unset label
# Factor de crecimiento Michoacan
clear
set output "1-7.png"
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
unset output
unset label

+ 29
- 0
plots/figura1.gp View File

@ -0,0 +1,29 @@
# 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-inicio-mexico.csv"
set linestyle 1 lc rgb 'black' pt 6 ps 2 # circle
set linestyle 2 lt 0 lw 3.3
# 1 Expo
set terminal png
set output "1-1.png"
f(x) = c*exp(d*x)
fit f(x) file using 2:3 via c, d
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)", c, d) 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 file using 2:3 title 'Casos' w p ls 1, \
f(x) with lines ls 2 title 'Exponencial'
set output
unset output
unset label

+ 31
- 0
plots/figura5.gp View File

@ -0,0 +1,31 @@
# Preparing data
#clear
#reset
set terminal png
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
# 5 Incremento diario
#clear
set output "1-5.png"
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*exp(%+-f*x)", c, d) at graph 0.01,0.85 font ',12'
set title 'Figura 5: Modelo exponencial 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
unset output
unset label

+ 31
- 0
plots/figura8.gp View File

@ -0,0 +1,31 @@
# Preparing data
#clear
#reset
set terminal png
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
# 5 Incremento diario
#clear
set output "1-8.png"
g(x) = c*exp(d*x)
fit g(x) file using 2:12 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 muertes diarias' font ',14'
set label sprintf("f(x)=%+-f*exp(%+-f*x)", c, d) at graph 0.01,0.85 font ',12'
set title 'Figura 8: Modelo para el número de muertes diarias en México' font ',14'
show title
set key left top font ',10' box 3
plot file using 2:12 title 'Incremento' w lp ls 1, \
g(x) with lines ls 2 title 'Regresor'
set output
unset output
unset label

Loading…
Cancel
Save