Gnuplot 如何将X轴设置为我的SQL提取临时文件中的日期?

Gnuplot 如何将X轴设置为我的SQL提取临时文件中的日期?,gnuplot,Gnuplot,经过多次阅读,我的用例中有些东西不起作用 我现在真的不明白为什么 我的摘录如下: 111 | 98.2 | 2020-07-11 112 | 99.2 | 2020-07-15 113 | 98.7 | 2020-07-25 122 | 99.2 | 2020-07-26 123 | 99.7 | 2020-07-27 124 | 97.8 | 2020-07-28 &我的gnuplot代码如下所示: gnuplot --persist << EOF || ( exit

经过多次阅读,我的用例中有些东西不起作用
我现在真的不明白为什么

我的摘录如下:

 111 | 98.2 | 2020-07-11
 112 | 99.2 | 2020-07-15
 113 | 98.7 | 2020-07-25
 122 | 99.2 | 2020-07-26
 123 | 99.7 | 2020-07-27
 124 | 97.8 | 2020-07-28
&我的gnuplot代码如下所示:

gnuplot --persist << EOF || ( exit 3 ) 
set xlabel "temps"
set ylabel "poid"
set terminal GNUTERM background rgb 'grey' size 1024,768
set grid ls 12
set sample 1000
set datafile separator "|"
set yrange [95:100]
set title "SUIVI POID"
set autoscale
plot "poid" with lines smooth bezier , "regime" with lines lt rgb "red" , "objectif" with lines smooth bezier lt rgb "white"
set terminal png
set output 'poid.png'
replot
pause mouse close
EOF
得到了那个错误:

gnuplot> plot "poid" with lines smooth bezier , "regime" with lines lt rgb "red" , "objectif" with lines smooth bezier lt rgb "white"
                                              ^
         line 0: Need full using spec for x time data
我试了很多方法来解决这个问题,但都失败了。我读了很多论坛的解决方案,但似乎没有一个与我的问题相匹配(我也误解了一些解决方案)


我希望将日期作为X标签

非常接近您的位置,主要问题是您没有正确声明日期格式,
timemt
应表示数据中日期的格式,您可以使用相同的格式设置
xrange
,然后,您可以使用3:2使用
进行绘图,告诉gnuplot使用第3列作为x坐标,第2列作为y坐标

对脚本进行此调整

set xlabel "temps"
set ylabel "poid"
set object rectangle from screen 0,0 to screen 1,1 behind fillcolor rgb 'grey' fillstyle solid noborder
set grid ls 12
set sample 1000
set datafile separator "|"
set yrange [95:100]
set title "SUIVI POID"
set autoscale
set autoscale
set xdata time
set timefmt "%Y-%m-%d"
set format x "%b %d"
set xrange ['2020-07-11':'2020-07-28']
plot "test.txt" u 3:2  with lines smooth bezier
我从你发布的样本数据摘录中得到了这个图。

警察局。qt
终端没有background属性,因此我在所有内容后面使用了一个矩形

set xlabel "temps"
set ylabel "poid"
set object rectangle from screen 0,0 to screen 1,1 behind fillcolor rgb 'grey' fillstyle solid noborder
set grid ls 12
set sample 1000
set datafile separator "|"
set yrange [95:100]
set title "SUIVI POID"
set autoscale
set autoscale
set xdata time
set timefmt "%Y-%m-%d"
set format x "%b %d"
set xrange ['2020-07-11':'2020-07-28']
plot "test.txt" u 3:2  with lines smooth bezier