Х топор на Gnuplot 4.6 - PullRequest
       8

Х топор на Gnuplot 4.6

0 голосов
/ 21 апреля 2020

У меня есть эти данные:

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 ):

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"

И вывод: enter image description here

Можете ли вы сказать мне, почему на оси 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 ....

Не могли бы вы мне помочь?

Спасибо!

1 Ответ

0 голосов
/ 22 апреля 2020

Оси X в Gnuplot 4.6

Ваши файлы в порядке со всеми датами: RHEL 7, CentOS 7 gnuplot-4.6.2, когда ось x отредактирована на «2020- 15 "(что является максимальным значением для отображения не только" каждого второго значения даты ")

EndDate = strptime("%Y-%d","2020-15")

enter image description here

Результат / поведение gnuplot: точно так же, например, с gnuplot- 5 .2.2.

Другой пример, gnuplot x обозначает "время% m.% y настройки" https://www.linuxquestions.org/questions/linux-software-2/%5Bgnuplot%5D-ugly-labels-4175670549/#post6096000

...