im a little bit new at gnuplot and i want to plot the evolution of COVID-19 in my country with x axis showing days instead of numbers.
Here is my data
#mm/dd , Infect
03/06 , 1
03/09 , 3
03/11 , 9
03/13 , 16
03/15 , 24
03/16 , 45
03/17 , 57
03/18 , 75
03/19 , 102
03/20 , 128
03/21 , 158
03/22 , 235
03/23 , 306
03/24 , 378
03/25 , 470
and heres my sript
set title 'COVID-19 En Colombia'
set ylabel 'Número de Personas'
set xlabel 'Día'
set xdata time
set timefmt '%m%d'
set format x '%m/%d'
set datafile sep ','
set key top left
set grid
set autoscale
set terminal png size 720,650
set output 'COVID19Col.png'
plot 'COVIDCol.dat' lt rgb 'red' w l title 'Infectados' using 1:3
but still telling me this
gnuplot> plot 'COVIDCol.dat' lt rgb 'red' w l title 'Infectados' using 1:3
"covid.gp" line 25: Need full using spec for x time data
I'd be very grateful for any help :3
There are several issues here:
using keyword needs to follow the file name, and it should be using 1:2.timefmt setting.autotitle columnhead to the key setting.With these changes it works:
plot.gp
set title 'COVID-19 En Colombia'
set ylabel 'Número de Personas'
set xlabel 'Día'
set xdata time
set timefmt '%m/%d'
set format x '%m/%d'
set datafile sep ','
set key top left autotitle columnheader
set grid
set autoscale
set terminal png size 720,650
set output 'COVID19Col.png'
plot 'COVIDCol.dat' using 1:2 lt rgb 'red' w l title 'Infectados'
Result:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With