-1

I have a text-file that has generated values every second by a radiation monitor via a serial-controller. How do I add this data up to hours, days, etc. for gnuplot to plot? Preferably added via gnuplot rather than a separate file.

For example:

30

32

28

30

32

Would be 5 seconds of data, how can I combine this via the gnuplot .dat file to generate a graph that is over an hour/day rather than every second?

I am new to gnuplot.

30

32

28

30

32

Generate a graph that is over an hour/day rather than every second.

1 Answers1

1

If a new line is generated every second, then plotting in bins of 60 will give counts/minute, plotting in bins of 3600 will give counts/hour, etc.

set ylabel "cts/minute"
plot "datafile" using 0:1 bins binwidth=60

"using 0:1" tells the program to generate bins from the line number and take the value of each line from column 1. You have not said what you would like the x axis to show. Let's assume you want elapsed time. You may also want to specify a plot style (points, lines, steps, ...) The commands would be

  set ylabel "cts/minute"
  set xdata time
  set xtics 60                 # one tic label every minute
  set xtics format "%tH:%tM"   # elapsed time in hours:minutes
  set xrange [0:*]             # start at zero elapsed time
  plot "datafile" using 0:1 bins binwidth=60  with steps

enter image description here

Ethan
  • 13,715
  • 2
  • 12
  • 21