Reputation: 83
I am trying plot graph with gnuplot. I would like to use data and time in x axis but it answers me: line 0: all points y value undefined!
but when I use 1st column (instead of date column it generate graph)
my data file:
1 2024-03-09_21-00-01 5.700000
2 2024-03-09_22-00-01 5.700000
3 2024-03-09_23-00-01 5.200000
4 2024-03-10_00-00-03 5.100000
5 2024-03-10_01-00-02 4.900000
6 2024-03-10_02-00-00 4.900000
7 2024-03-10_03-00-02 5.100000
8 2024-03-10_04-00-02 5.500000
9 2024-03-10_05-00-03 5.200000
10 2024-03-10_06-00-03 5.900000
my working script (without using date):
#!/bin/bash
gnuplot -persist <<-EOFMarker
set autoscale y
set pointsize 0.1
plot "./hs.txt" using 1:3 with linespoints
EOFMarker
# rest of script, after gnuplot exits
my code which uses date at x axis(but answers all points y value undefined!) :
#!/bin/bash
gnuplot -persist <<-EOFMarker
set xdata time
set timefmt '"%Y-%m-%d_%H-%M-%S"'
set xrange ['"2024-03-10_00-00-00"':'"2024-03-10_06-00-00"']
set format x '"%Y-%m-%d"'
set autoscale y
set pointsize 0.1
plot "./hs.txt" using 2:3 with linespoints
EOFMarker
# rest of script, after gnuplot exits
Please could anybody give me some advice what I am doing wrong? Thanks all a lot!
Upvotes: 0
Views: 31
Reputation: 83
When I try solve some previous problem, I have found solution with singe and then with double quotes. But it was probably for sam older version of gnuplot. So I have removed single quotes and it is working now. Thanks all for reply.
For sure - workicng code:
#!/bin/bash
gnuplot -persist <<-EOFMarker
set xdata time
set timefmt "%Y-%m-%d_%H-%M-%S"
set xrange ["2024-03-10_00-00-00":"2024-03-10_06-00-00"]
set format x "%Y-%m-%d"
set autoscale y
set pointsize 0.1
plot "./hs.txt" using 2:3 with linespoints
EOFMarker
# rest of script, after gnuplot exits
Upvotes: 0