I have a time series that count as dates (set timefmt "%d.%m.%Y"). I would like to have a second, x2 axies displaying the same data in weeks (set format x2 "%Ww"), so I wrote this script (below) but the boxxy errorbars drawing for x2y1 seem to be shifted. Why is that?
$test0<<EOD
m1 01.06.2025 30.06.2025
m2 10.06.2025 17.07.2025
m3 20.06.2025 08.08.2025
EOD
set term qt font "Carlito,12" butt antialias size 1440,360
set timefmt "%d.%m.%Y"
OneMonth = strptime("%m","2")
set xdata time
set format x "%b %y"
set x2data time
set format x2 "%Ww"
unset border
set yrange [-1:3]
set xrange ["20.05.2025":"20.08.2025"]
set xtics OneMonth nomirror
set xtics offset 0,0.5
set x2tics nomirror scale 0.8,0.5 font ",10" offset 0,-0.5
set mxtics 4 set mx2tics 2 set ytics nomirror offset 1.5,0
set style fill transparent solid 0.3
set key noautotitle
set ytics nomirror
set grid y
unset key
plot $test0 using 2:($0) : 2:3 : ($0)-0.2:($0)+0.2 : yticlabel(1) with boxxy lc "blue" axes x1y1,\
$test0 using 2:($0) : 2:3 : ($0)-0.2:($0)+0.2 : yticlabel(1) with boxxy lc "green" axes x2y1
The x and x2 axis ranges are independent unless you do something to force them to match. That could either be setting them both to the same range in parallel:
set xrange ["20.05.2025":"20.08.2025"]
set x2range ["20.05.2025":"20.08.2025"]
or using the set link
command to link them automatically:
set link x2