Here is my code:
set title "Samples plot"
set xlabel "Samples"
set ylabel "Volts"
set yrange [15:30]
set grid
unset mouse
set timestamp
set key center left
plot "py.out" using 1:2 skip 2 with lines lw 2 t "Battery", \
"py.out" using 1:3 skip 2 with boxes t "Inverter", \
26.0 t "Inverter on", \
24.8 lw 4 t "Nominal", \
23.0 t "Inverter off"
The data file looks something like this:
1 22.50 0
2 22.56 0
(etc, until the inverter turns on at 26)
5199 25.85 0
5200 26.45 23
5201 24.80 23
(etc, until it drops below 23 - then the controller cuts it off)
Obviously, the sample number is the independent variable. The sampling runs at about every 2 seconds.
I am mostly where I want things to be, except for one nagging question about Gnuplot.
Here is the plot I am getting:
So my question is:
How can I utilize Gnuplot to convert the sample numbers into times? This system takes about 1800 samples per hour. I am willing to add code that sets the first sample to be a specific time and to adjust the number of samples per hour to dial it in to match actual times.
More information - New Day:
So today I have 9,000 samples covering from 6:00 to 11:00, and my plot looks like this:
Then with the plot command changed to this:
plot "py.out" using (int($1/1800)+6):2 skip 2 with lines lw 2 t "Battery", \
"py.out" using (int($1/1800)+6):3 skip 2 with boxes t "Inverter", \
Using the same data, I get a graph that looks like this:
Doing math within the plot command is causing it to change more than just the axis markings.
int
inint($1/1800)+6
- otherwise, all data points within one hour are squashed into one vertical line segment as seen on, e.g., the red line in your last plot – ewcz