Gnuplot 4.6上的X轴 [英] X axe on Gnuplot 4.6
问题描述
我有此数据:
2020-04;26.94
2020-05;26.92
2020-06;26.89
2020-07;27.01
2020-08;26.73
2020-09;26.72
我使用此gnuplot脚本(我必须使用Gnuplot的 4.6 版本):
I use this gnuplot script ( I'm bound to use the 4.6 version of Gnuplot ) :
reset
FILE = "LINEARFIT.txt"
set datafile separator ";"
set xdata time
set timefmt "%Y-%d"
set format x "%Y\n%d"
plot FILE u (StartDate=timecolumn(1)):0 index 0 every ::0:0:0
EndDate = strptime("%Y-%d","2020-20")
f(x) = a*(x-StartDate) + b
FIT_LIMIT = 1e-8
fit f(x) FILE u (timecolumn(1)):2 via a,b
set terminal png truecolor size 900,520 background rgb "#eff1f0"
set output "/xxx/xxx/xxx/xxx.png"
set xrange[StartDate:EndDate]
set grid xtics, ytics
set yrange[0:30]
set format y "%g"
myLabel(n) = sprintf("%g",n)
plot FILE u (timecolumn(1)):2 w lp pt 7 lc rgb "red" notitle, \
'' using 1:2:(myLabel($2)) w labels offset 0,-0.5 notitle, \
f(x) ti "linear fit with extrapolation"
输出为:
您能告诉我为什么在x轴上显示值"二乘二":2020- 04 ,2020- 06 ,2020- 08 ,2020- 10 ,2020- 12 ,2020- 014 ,2020- 16 ,2020- 18 ,2020- 20 ...而我想要2020- 04 ,2020- 05 ,2020- 07 ,2020- 08 ,2020- 09 ,2020- 10 ,2020- 11 ,2020- 12 ....
Can you tell me why, on the x axe, the values are displayed "Two by two" : 2020-04,2020-06,2020-08,2020-10,2020-12,2020-014,2020-16,2020-18,2020-20... While I want 2020-04,2020-05,2020-07,2020-08,2020-09,2020-10,2020-11,2020-12 ....
你能帮我吗?
谢谢!
推荐答案
Gnuplot 4.6上的X轴
X axes on Gnuplot 4.6
您的文件可以带有所有日期":在x轴被编辑为"2020-15"(这是最大设置)时,RHEL 7,CentOS 7
Your files are OK with "all dates" : The RHEL 7, CentOS 7 gnuplot-4.6.2
, when the x axis is edited to "2020-15" (which is the maximum setting for not showing only "every second date setting")
EndDate = strptime("%Y-%d","2020-15")
结果/gnuplot行为与例如gnuplot- 5 .2.2.
The result / the gnuplot behaviour is exactly the same with e.g. gnuplot-5.2.2 .
Other example, gnuplot x labels "time %m.%y settings" https://www.linuxquestions.org/questions/linux-software-2/%5Bgnuplot%5D-ugly-labels-4175670549/#post6096000
这篇关于Gnuplot 4.6上的X轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!