|
From: theozh <th...@gm...> - 2018-10-13 22:21:05
|
Thank you for your comments. @John > Does this help? > https://stackoverflow.com/questions/17791828/gnuplot-date-time-in-x-axis No, not helpful in my case. @Alan well, in my 5.2 manual there is %U and %w but no %u. I'm not sure if it can be used for what I want to achieve. My current solution looks like the following (see example below). If it can be done simpler, I would be happy to learn about it. Disadvantage: I have to set xtics manually and don't see how to set mxtics. ### plot as a function of weekday reset $BirthData <<EOD # "%a" "%d.%m.%Y" "%H:%M:%S" "SomeValue" "time in s from 1.1.1970" Mon 13.02.1922 12:34:34 85.3 -1511004326.0 Tue 15.5.1962 04:12:18 73.1 -240868062.0 Wed 11.08.1948 09:12:56 97.3 -675010024.0 Thu 01.01.1970 00:00:00 32.7 0.0 Fri 31.12.1999 09:09:09 5.3 946631349.0 Sat 13.10.2018 18:45:01 45.2 1539456301.0 Sun 15.5.1966 04:12:18 17.4 -114637662.0 EOD set multiplot layout 2,1 set xdata time set format x "%Y" plot $BirthData u (timecolumn(2,"%d.%m.%Y")):4 lt 6 lc rgb "blue" # define formula Weekdaytime(t) = (floor(t/86400. + 3.)%7 + 7)%7 + t/86400. - floor(t/86400.) # 86400 seconds per day # 0=Mon, 1=Tue, 2=Wed, 3=Thu, 4=Fri, 5=Sat, 6=Sun # (... %7+7)%7 to account for negative time before 1.1.1970 # add 3 days because time=0 is 1.1.1970 and was a Thursday set xdata set format "%g" set xrange[0:7] set xtics ("Mon" 0, "Tue" 1, "Wed" 2, "Thu" 3, "Fri" 4, "Sat" 5, "Sun" 6) plot $BirthData u (Weekdaytime(timecolumn(2,"%d.%m.%Y %H:%M:%S"))):4 lt 6 lc rgb "red" not unset multiplot ### end of code |