1
votes

I have multiple CSV files with similar data: (09082020.CSV, 10082020.CSV, 11082020.CSV, 12082020.CSV etc.)

DateTime;Temperature[deg C]
16.06.2020 08:00;5.12
16.06.2020 08:01;5.67
16.06.2020 08:02;6.78
16.06.2020 08:03;7.99
16.06.2020 08:04;7.55
...

In Gnuplot x1- and x2- axis settings are:

set timefmt "%d.%m.%Y %H:%M"
set xdata time
set x2data time
set format x "%H"
set format x2 "%d"
set xtics 3600
set x2tics 3600
set xlabel "Hour"
set x2label "Day of month"

This produces equal amount of tics on both x- and x2- axis. I would like the "Day of month" label on x2-axis to appear only at midnight (00:00), not every hour. If I change the parameter "set x2tics" to something else (other than 3600), the tics will be misaligned compared to the x1-axis. So my question is - how to make the Gnuplot to show HOUR on primary x-axis and DAY OF MONTH on secondary x-axis (at midnight).

1

1 Answers

0
votes

Check the following example and in the gnuplot console help link and help format. My guess would be that you are looking for something like this.

Code:

### link x2 time axis to x time axis
reset session
myTimeFmt = "%d.%m.%Y %H:%M"

# create some test data
set print $Data
    do for [i=1:1000] {
        print sprintf("%s %g", strftime(myTimeFmt,time(0)+i*250), i%200)
    }
set print

set xlabel "Hour"
set format x "%H" timedate

set x2label "Day of month"
set format x2 "%d" timedate
set x2tics 3600*24
set link x2 via x inverse x

plot $Data u (timecolumn(1,myTimeFmt)):2 w l notitle

### end of code

Result:

enter image description here